Abstraction Mechanisms, Part 1
- slide 7 : 36
More about constructors
Additional properties of constructos in C++
The C++ Programming Language
: Page 226, 247, 270
Overloaded constructors
Constructors can be overloaded, just as other functions
Explicit constructors
By means of an
explicit
specifier before the constructor
Cannot be used in implicite type conversion
Default constructor
In case a constructor is defined there will be no parameterless default constructor
As in C#
Can be called without actual parameters
Either parameterless, or with default values for every parameter
Used for initialization of automatic variables of class type
Copy constructor
A constructor that takes a single reference parameter to its class
Generated automatically - if needed - and if not programmed explicitly