Constructor (object-oriented programming)
Special method used for initializing a newly allocated object in object-oriented programming
In class-based, object-oriented programming, a constructor (abbreviation: ctor) is a special type of function called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.
Nº Q1049476 ★
Common · Knowledge
Constructor (object-oriented programming)
Special method used for initializing a newly allocated object in object-oriented programming
In class-based, object-oriented programming, a constructor (abbreviation: ctor) is a special type of function called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.
From Wikipedia
In class-based, object-oriented programming, a constructor (abbreviation: ctor) is a special type of function called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables. A constructor resembles an instance method, but it differs from a method in that it has no explicit return type, it is not implicitly inherited and it usually has different rules for scope modifiers. Constructors often have the same name as the declaring class. They have the task of initializing the object's data members and of establishing the invariant of the class, failing if the invariant is invalid. A properly written constructor leaves the resulting object in a valid state. Immutable objects must be initialized in a constructor. Most languages allow 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 factories, which also create objects but can do so in various ways, using multiple classes or different allocation schemes such as an object pool.
Text: Wikipédia, CC BY-SA 4.0. · Image: Tevfik AKTUĞLU (CC BY-SA 4.0) ·
Related cards
-
Architect
Person trained to plan and design buildings, and oversee their construction
Nº Q42973 ★★★★
Not listed
-
Structural engineering
A sub-discipline of civil engineering dealing with the design and analysis of load-bearing structures
Nº Q633538 ★★
Not listed
-
Assembly language
Any low-level programming language in which there is a very strong correspondence between the instructions in the language and the architecture's machine code instructions
Nº Q165436 ★★★★
Not listed
-
B
Boat builder
Wood working profession; person who builds and repairs wooden boats
Nº Q548031 ★
Not listed
-
Decorator pattern
Design pattern in object-oriented programming
Nº Q23839 ★★
Not listed
-
Processor (computing)
Electrical component for processing data
Nº Q1466064 ★★★★
Not listed
-
cultivator
Subclass of farmer
Nº Q23817608 ★
Not listed
-
Container (abstract data type)
Software class, data structure, or abstract data type (ADT) whose instances are collections of other objects
Nº Q1643805 ★
Not listed
-
Inheritance (object-oriented programming)
Concept in object-oriented programming
Nº Q212542 ★★
Not listed
-
Carpenter
Profession; person who performs carpentry
Nº Q154549 ★★★★
Not listed
-
b
broadcast writer
Television occupation
Nº Q11499012 ★★★
Not listed
-
N
Ninja (build system)
Free build automation software
Nº Q28975257 ★
Not listed
-
Pair programming
Collaborative technique for software development
Nº Q607013 ★★
Not listed
-
Haskell
Purely functional programming language
Nº Q34010 ★★★
Not listed
-
c
construction officer
Historical official title in the construction industry
Nº Q811111 ★★
Not listed
-
P
Programming tool
Computer program that software developers use to support other programs and applications
Nº Q1077784 ★
Not listed
-
Singer-songwriter
Musician who writes, composes and sings own songs
Nº Q488205 ★★★★★
Not listed
-
c
construction consultant
Occupation
Nº Q11486801 ★★
Not listed