Download presentation
Presentation is loading. Please wait.
1
Chapter 11 Inheritance and Polymorphism
Dr. Clincy Lecture
2
Inheritance We talked about Inheritance and the benefits of inheritance We talked about the Superclass and Subclass We talked about Overriding versus overloading We also talked about every class in Java being a descendent from the java.lang.Object class. If no inheritance is specified when a class is defined, the superclass of the class is Object. Talked about constructor chaining and the use of the keyword super Because of inheritance, sometimes you need to know what object you are using. So, in Lab 3, you were introduced to the toString() method The toString() method returns a string representation of the object. The default implementation returns a string consisting of (1) a class name of which the object is an instance, (2) the at sign, and (3) a number representing this object. Example: Usually you should override the toString method so that it returns a string representation of the object that provides more useful info. Dr. Clincy Lecture
3
Inheritance For Lab 4 Part 2, we will continue to implement these concepts For Lab 4 Part 1 - other Dr. Clincy Lecture
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.