CS 18000 Lecture Notes - Lecture 9: Reserved Word, Multiple Inheritance

39 views3 pages

Document Summary

Inheritance: some class have related or overlapping functionality ex: student and professor can both be classified in the person class. Java allows classes to share member definitions in a hierarchical fashion, one class (cid:272)a(cid:374) (cid:862)e(cid:454)te(cid:374)d(cid:863) a(cid:374)other (cid:862)i(cid:374)heriti(cid:374)g(cid:863) fields a(cid:374)d (cid:373)ethods fro(cid:373) it (cid:894)su(cid:271)(cid:272)lass i(cid:374)herits fro(cid:373) the super(cid:272)lass. One designated class in java-object, is the root of all classes and is implicitly extended by any class that does not extend another class. } //down here we have getters and setters for classes. Object class methods: the object class has a small number of public methods clone() makes a copy of an object equals(object e) compares for equality tostring() returns a string representation. Constructor chaining: java enforces constructor chaining by inserting implicit calls to superclass constructors which you can override by inserting your own calls. If (cid:455)ou do(cid:374)"t pro(cid:448)ide a(cid:374)(cid:455) (cid:272)o(cid:374)stru(cid:272)tors i(cid:374) a (cid:272)lass, ja(cid:448)a pro(cid:448)ides o(cid:374)e for (cid:455)ou: public classname() { super();

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