Lecture overview -- Keyboard shortcut: 'u'  Previous page: Inheritance in C++ -- Keyboard shortcut: 'p'  Next page: Inheritance: Copying and slicing -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 4 - Page 2 : 24
Notes about C++
Abstraction Mechanisms, Part 2
Inheritance: Constructors and destructors

Constructors in class hierarchies work as expected in C++

 

  • The C++ Programming Language: Page 306
 

  • Constructor rules

    • A subclass constructor invoke the superclass constructors - implicitly or explicitly

      • Constructors with parameters must be invoked explicitly

      • Default constructors can be invoked implicitly

    • Bottom up construction and top down destruction

      • First base class constructors, then derived class constructors

      • Multiple base classes are constructed in their declaration order

y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/constructor-inh/single-1.ccConstructors and single inheritance.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/constructor-inh/multiple-1.ccConstructors and multiple inheritance.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/constructor-inh/multiple-2.ccConstructors and multiple inheritance - implicit activation of default constructor in Base.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/constructor-inh/multiple-4.ccConstructors and multiple inheritance - order of construction and destruction.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/constructor-inh/multiple-5.ccConstructors and multiple inheritance - order of construction and destruction.