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
-
c
contractor
Person or business that performs services of any type under contract
Nº Q15982656 ★★★
Not listed
-
S
SOLID
Acronym for object-oriented design in computer programming
Nº Q2583627 ★★★
Not listed
-
D
Declaration (computer programming)
Language construct in computer programming for specification of an identifier
Nº Q1183659 ★★
Not listed
-
C
Cargo cult programming
Style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose
Nº Q1027351 ★★
Not listed
-
O
Object file
File containing relocatable format machine code
Nº Q14902318 ★
Not listed
-
Bricklayer
Craftsman who builds walls using stones and/or bricks
Nº Q327321 ★★★
Not listed
-
Construction
Process of the building or assembling of a building or infrastructure
Nº Q3875186 ★★★★
Not listed
-
General contractor
Profession, construction site manager
Nº Q289612 ★★★★
Not listed
-
Concrete and steel-reinforced concrete constructors
Profession
Nº Q831500 ★
Not listed
-
m
master builder
Central figure leading construction projects
Nº Q1340643 ★★★
Not listed
-
Gemcutter
Profession
Nº Q1283397 ★
Not listed
-
Carreteiro
South American oxcart driver
Nº Q9697758 ★
Not listed
-
Clipper (programming language)
Programming language
Nº Q834358 ★★
Not listed
-
Type designer
Person who designs typefaces
Nº Q354034 ★
Not listed
-
interior designer
Person who designs the interior decoration of a room or building; who plans, researches, coordinates, and manages such projects
Nº Q2133309 ★★
Not listed
-
B
Bootloader
Computer program that is used when starting a computer
Nº Q836795 ★★
Not listed
-
C
C++Builder
Integrated development environment
Nº Q890655 ★
Not listed
-
Architect
Person trained to plan and design buildings, and oversee their construction
Nº Q42973 ★★★★
Not listed