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 exercise of letters is sometimes linked to the ambition to contruct an absolute book, a book of books that includes the others like a Platonic archetype, an object whose virtues are not diminished by the passage of time.”
—Jorge Luis Borges (18991986)
“Had Cleopatras nose been shorter, the whole face of the world would have changed.”
—Blaise Pascal (16231662)