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
-
A
Attorney at law
Professional title for lawyers in some jurisdictions
Nº Q758225 ★★★
Not listed
-
S
Scalar processor
Class of computer processors that process only one data item at a time, typically integers and floating point numbers
Nº Q1151063 ★★
Not listed
-
Machine fly
Strength training exercise based on the free weight chest fly, but in a chest fly machine
Nº Q6723722 ★★★
Not listed
-
Inventor
Person that devises a new device, method, composition, or process
Nº Q205375 ★★★
Not listed
-
S
Scaffold (programming)
Term that comes from the Ruby on Rails framework, which is a facility to construct most of the logic and views needed to do common data access operations, such as CRUD
Nº Q735710 ★★
Not listed
-
G
God object
Programming term
Nº Q1533624 ★
Not listed
-
Knowledge worker
Worker whose main capital is knowledge
Nº Q1914017 ★
Not listed
-
Vector processor
Computer processor which works on arrays of several numbers at once
Nº Q919509 ★★
Not listed
-
L
Legal guardian
Person who has the legal authority to care for the personal and property interests of another person or comunity
Nº Q157509 ★★
Not listed
-
B
Bc (programming language)
UNIX utility which implements an arbitrary-precision arithmetic language
Nº Q300897 ★★
Not listed
-
M
Multi-paradigm programming language
Programming language type
Nº Q12772052 ★★
Not listed
-
cobrador
Nº Q18472382 ★★
Not listed
-
i
importer
Profession
Nº Q1660363 ★★
Not listed
-
Desktop computer
Personal computer in a form intended for regular use at a single location desk/table
Nº Q56155 ★★★
Not listed
-
s
scope
Nº Q10274706 ★★
Not listed
-
Announcer
Presenter who makes announcements in an audio medium or a physical location
Nº Q1371925 ★★★★
Not listed
-
piano tuner
Profession
Nº Q1191329 ★★
Not listed
-
Compiler
Computer program that transforms source code into object code
Nº Q47506 ★★★
Not listed