Unit 9: Inheritanve

Unit 9: Inheritance

Creating objects, calling methods on the objects created, and being able to define a new data type by creating a class are essential understandings before moving into this unit. One of the strongest advantages of Java is the ability to categorize classes into hierarchies through inheritance. Certain existing classes can be extended to include new behaviors and attributes without altering existing code. These newly created classes are called subclasses. In this unit, students will learn how to recognize common attributes and behaviors that can be used in a superclass and will then create a hierarchy by writing subclasses to extend a superclass. Recognizing and utilizing existing hierarchies will help students create more readable and maintainable programs.


ESSENTIAL QUESTIONS

Modularity [MOD]

How might the use of inheritance help in writing a program that simulates crops being grown in a virtual world?

How does inheritance make programs more versatile?


BIG IDEAS

+ Using common attributes and behaviors to group existing objects into superclasses

+ Defining and overriding methods within subclasses and superclasses

+ Creating references using inheritance hierarchies

+ Associating subclass objects with superclasses to create polymorphism


UNIT TOPICS & ACTIVITIES

9.1: Creating Superclasses and Subclasses

9.2: Writing Constructors for Subclasses

9.3: Overriding Methods

9.4: super Keyword

9.5: Creating References Using Inheritance Hierarchies

9.6: Polymorphism

9.7: Object Superclass


Link to Brainscapes

SKILLS ADDRESSED


Program Design and Algorithm Development

1.A: Determine an appropriate program design to solve a problem or accomplish a task (not assessed).

1.C: Determine code that would be used to interact with completed program code.

Code Implentation

3.A: Write program code to create objects of a class and call methods.

3.B: Write program code to define a new type by creating a class.

Documentation

5.A: Describe the behavior of a given segment of program code

5.B: Explain why a code segment will not compile or work as intended.

5.D: Describe the initial conditions that must be met for a program segment to work as intended or described.