Object Pascal
In Object Pascal, the constructor is similar to a factory method. The only syntactic difference to regular methods is the keyword constructor
in front of the name (instead of procedure
or function
). It can have any name, though the convention is to have Create
as prefix, such as in CreateWithFormatting
. Creating an instance of a class works like calling a static method of a class: TPerson.Create('Peter')
.
Read more about this topic: Constructor (object-oriented Programming)
Famous quotes containing the words object and/or pascal:
“Lets call something a rigid designator if in every possible world it designates the same object, a non-rigid or accidental designator if that is not the case. Of course we dont require that the objects exist in all possible worlds.... When we think of a property as essential to an object we usually mean that it is true of that object in any case where it would have existed. A rigid designator of a necessary existent can be called strongly rigid.”
—Saul Kripke (b. 1940)
“Our senses perceive no extreme. Too much sound deafens us; too much light dazzles us; too great distance or proximity hinders our view. Too great length and too great brevity of discourse tends to obscurity; too much truth is paralyzing.... In short, extremes are for us as though they were not, and we are not within their notice. They escape us, or we them.”
—Blaise Pascal (16231662)