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:
“An object among dreams, you sit here with your shoes off
And curl your legs up under you;”
—Randall Jarrell (19141965)
“The weather and my mood have little connection. I have my foggy and my fine days within me; my prosperity or misfortune has little to do with the matter.”
—Blaise Pascal (16231662)