You would not want to write all of the code again that creates a Person, you already did all of that work! You could write a Student class that extends the Person class.

Words: 298
Pages: 2
Subject: Accounting

Unit 9: OOP – Inheritance

Overview:

Inheritance is a foundational OOP concept in Java. You have the ability to use all of the data and services from an existing class and write a class that is a more specific version of that class. This is called extending a class. E.g. You have a class called Person that represents all of the data and services that all
Persons would have and do. Maybe your program needs a more specific type of person like a Teacher or a Student.

You would not want to write all of the code again that creates a Person, you already did all of that work! You could write a Student class that extends the Person class.

Student would have all of the things that a Person would have and then the added functionality of a Student. We will look at several examples of inheritance hierarchies and build on to one of them in the BOTS
project.

In this chapter you will learn about:
• Superclass and subclass
• Protected members
• Relationship between superclass and subclass
• Constructors in subclasses
• Extends keyword
• Class Object

Resources:

• Java: How to Program early objects 10ed. – Deitel
• IntelliJ
• Lecture files and code examples in the book
• BOTS! OOPLectureFiles
o This has a ton of files for the BOTS assignment and they go along with the videos.

 

Let Us write for you! We offer custom paper writing services Order Now.

REVIEWS


Criminology Order #: 564575

“ This is exactly what I needed . Thank you so much.”

Joanna David.


Communications and Media Order #: 564566
"Great job, completed quicker than expected. Thank you very much!"

Peggy Smith.

Art Order #: 563708
Thanks a million to the great team.

Harrison James.


"Very efficient definitely recommend this site for help getting your assignments to help"

Hannah Seven