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
-
Personal computer
Computer intended for use by an individual person
Nº Q16338 ★★★★
Not listed
-
u
uploader
Someone who uploads video, audio, or other resources online
Nº Q18651180 ★★★
Not listed
-
Printmaker
Person who makes prints from plates or blocks
Nº Q11569986 ★
Not listed
-
Classical order
Styles of classical architecture, most readily recognizable by the type of column employed
Nº Q217175 ★★★★
Not listed
-
Debugger
Computer program used to test and debug other programs
Nº Q193231 ★
Not listed
-
S
Single-responsibility principle
Computer-programming principle that states that every class in a computer program should have responsibility over a single part of that program's functionality, which it should encapsulate
Nº Q197857 ★★★
Not listed
-
t
train compiler
Nº Q16699775 ★★
Not listed
-
buildings technician
Nº Q10270209 ★
Not listed
-
f
founder
Worker specialized in metal casting
Nº Q12031226 ★
Not listed
-
Ombudsman
Official representing the interests of the public
Nº Q169180 ★★★
Not listed
-
V
Vala (programming language)
Programming language
Nº Q1138939 ★
Not listed
-
S
Stored-program computer
Computer that executes program instructions that it reads from memory
Nº Q1134867 ★
Not listed
-
Tensor
Multilinear map on some combination of scalars, vectors, covectors, and tensors
Nº Q188524 ★★★★
Not listed
-
posseiro
Nº Q10352109 ★★
Not listed
-
Comment (computer programming)
Explanatory note in the source code of a computer program, skipped during its compilation or interpretation and without effect on execution
Nº Q1141067 ★
Not listed
-
u
umbrella maker
Nº Q2236354 ★
Not listed
-
A
Agent-oriented programming
Programming paradigm centred on the concept of software agents
Nº Q139008 ★
Not listed
-
I
Idle (CPU)
Waiting state of a computer processor
Nº Q1812200 ★
Not listed