Lecture overview -- Keyboard shortcut: 'u'  Previous page: Constructors - initialization versus assignment -- Keyboard shortcut: 'p'  Next page: Use of constructors -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 3 - Page 7 : 36
Notes about C++
Abstraction Mechanisms, Part 1
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