Content deleted Content added
Da cameron (talk | contribs) Changing "ColdFusion" to "CFML": CFML is the language; ColdFusion is a vendor implementation. Adding code example for initmethod |
More direct wikilink: Class_invariant instead of just Invariant_(computer_science) for "invariant of the class" |
||
Line 4:
In [[class-based programming|class-based]] [[object-oriented programming]], a '''constructor''' (abbreviation: '''ctor''') in a [[Class (computer programming)|class]] is a special type of [[subroutine]] called to [[object creation|create an object]]. It prepares the new object for use, often accepting [[argument]]s that the constructor uses to set required [[member variable]]s.
A constructor resembles an [[method (computer science)|instance method]], but it differs from a method in that it has no explicit [[return type]], it is not implicitly [[inheritance (object-oriented programming)|inherited]] and it usually has different rules for scope modifiers. Constructors often have the same name as the declaring [[class (computer science)|class]]. They have the task of [[initialization (computing)|initializing]] the object's [[data member]]s and of establishing the [[
Programmers also use the term ''constructor'' to denote one of the tags that wraps data in an [[algebraic data type]]. This is a different usage than in this article.{{Dubious|date=August 2009}}
|