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:
“The division between the useful arts and the fine arts must not be understood in too absolute a manner. In the humblest work of the craftsmen, if art is there, there is a concern for beauty, through a kind of indirect repercussion that the requirements of the creativity of the spirit exercise upon the production of an object to serve human needs.”
—Jacques Maritain (18821973)
“What a chimera then is man. What a novelty! What a monster, what a chaos, what a contradiction, what a prodigy. Judge of all things, imbecile worm of the earth; depositary of truth, a sink of uncertainty and error: the pride and refuse of the universe.”
—Blaise Pascal (16231662)