Lecture overview -- Keyboard shortcut: 'u'  Previous page: Methods in the class <b><kbd>Object</kbd></b> in C# -- Keyboard shortcut: 'p'  Next page: Constructors and initialization order -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 24 : 40
Object-oriented Programming in C#
Specialization, Extension, and Inheritance
Inheritance and Constructors

Constructors are not inherited

 

  • Each class in a class hierarchy should have its own constructor(s)

  • The constructor of class C cooperates with constructors in superclasses of C to initialize a new instance of C

  • A constructor in a subclass will always, implicitly or explicitly, refer to a constructor in its superclass

/user/normark/oop-csharp-1/sources/c-sharp/bank-account/inheritance-1/bank-account.csConstructors in class BankAccount.


/user/normark/oop-csharp-1/sources/c-sharp/bank-account/inheritance-1/check-account.csConstructors in class CheckAccount.


/user/normark/oop-csharp-1/sources/c-sharp/bank-account/inheritance-1/savings-account.csConstructors in class SavingsAccount.


/user/normark/oop-csharp-1/sources/c-sharp/bank-account/inheritance-1/lottery-account.csConstructors in class LotteryAccount.