Content deleted Content added
Undid revision 1213477586 by 49.248.21.30 (talk) |
m redirect bypass from Method (computer science) to Method (computer programming) using popups |
||
Line 4:
In [[class-based programming|class-based]], [[object-oriented programming]], a '''constructor''' (abbreviation: '''ctor''') is a special type of [[Function (computer programming)|function]] called to [[object creation|create an object]]. It prepares the new object for use, often accepting [[Parameter (computer programming)|arguments]] that the constructor uses to set required [[member variable]]s.
A constructor resembles an [[
Most languages allow [[method overloading|overloading]] the constructor in that there can be more than one constructor for a class, with differing parameters. Some languages take consideration of some special types of constructors. Constructors, which concretely use a single class to create objects and return a new instance of the class, are abstracted by [[Factory (object-oriented programming)|factories]], which also create objects but can do so in various ways, using multiple classes or different allocation schemes such as an [[object pool]].
|