CSC207H1 Lecture : oct01c.docx
Document Summary
The inheritance hierarchy: no class can have more than one parent, if a class has no parent declared, it is a child of class object. A few quick points about inheritance: super refers to the part of the object that is defined by its parent class, you can call a constructor in the parent class by calling super(arguments) There are subtleites we"ll discuss next week: child classes don"t have access to private members of their parent. Constructors and inheritance: when you say new, the appropriate constructor is called (based on the number and type of arguments, if the first step is super(arguments) The appropriate constructor in the parent class is called. Good practice: initialize only your own variables, and count on ancestors to take care of theirs. No-arg constructors: if you don"t define any constructors for your class, the compiler will define one with no arguments and an empty body.