CSC207H1 Lecture : oct01c.docx

42 views2 pages
11 Jan 2013
School
Course
Professor

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents