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
-
Worker
Person who works
Nº Q327055 ★★★
Not listed
-
Programmer (hardware)
Device that configures programmable non-volatile integrated circuits
Nº Q1374194 ★★
Not listed
-
Visitor pattern
Design pattern
Nº Q830719 ★★
Not listed
-
PowerBuilder
Integrated development environment
Nº Q580882 ★
Not listed
-
Programmer
Person who writes computer software (subclass of software developer)
Nº Q5482740 ★★★★
Not listed
-
F
Function object
Programming construct allowing an object to be invoked or called as if it were an ordinary function, usually with the same syntax
Nº Q2072111 ★
Not listed
-
Animator
Person who makes animated sequences out of still images
Nº Q266569 ★★★★
Not listed
-
architectural drafter
Occupation
Nº Q2079935 ★★
Not listed
-
User (computing)
Person who uses tools or other equipment, such as a device.
Nº Q278368 ★★★★
Not listed
-
Adapter pattern
Design pattern in computer program
Nº Q23836 ★★
Not listed
-
Observer pattern
Design pattern
Nº Q818562 ★★
Not listed
-
O
Object (computer science)
Programming element that groups data with relevant operations/behaviors
Nº Q216601 ★★
Not listed
-
M
Modelist-Konstruktor
Nº Q4299310 ★★
Not listed
-
I
Instance (computer science)
Object that is a concrete manifestation of a class in software development
Nº Q1664689 ★★
Not listed
-
P
Prototype-based programming
Style of object-oriented programming
Nº Q180868 ★
Not listed
-
Impeller
Rotor used to increase (or decrease in case of turbines) the pressure and flow of a fluid or gas
Nº Q1698700 ★★★
Not listed
-
c
creator
Person who does creative work
Nº Q2500638 ★★
Not listed
-
Computer architecture
Set of rules and methods that describe the functionality, organization and implementation of computer systems
Nº Q173212 ★★★★
Not listed