Page 323 - Computer_Science_F5
P. 323
Computer Science Inheritance Polymorphism
This is a unique feature of Object In Greek language, polymorphism
Oriented Programming in Java. It enables is regarded as taking many forms. In
Java, polymorphism is like different
programmers to construct new classes
types of vehicles (cars, bicycles, trucks)
with some of the attributes of pre-existing
FOR ONLINE READING ONLY
which shares the same road. Although
classes shared.
each vehicle behaves differently, but
they all follow the same traffic rules.
Activity 5.3:
Similarly, objects of different classes can
Exploring of inheritance in the share common methods and be treated
surrounding environments uniformly, despite their unique behaviors.
Aim:
To understand the concept of Activity 5.4:
inheritance in OOP with Java by Exploring of polymorphism in the
exploring real-world examples where surrounding environments
properties are inherited from a parent
entity to a child entity Aim:
To identfy and understand the real
Materials: TV, Toy animals, Family world examples of polymorphism and
tree chart, surrounding environments its roles in allowing objects to exhibit
or Internet different behaviours based on their
Instructions: contexts.
In human families, a child inherits Material:
the properties from his father. In Java Vehicles, various shapes, various types
perspective the two groups are known of bank accounts, various media files,
as parent class (Super or Base class) and surrounding environments or Internet
Child class (derived class or subclass)
A class that receives inheritance is Instructions:
referred to as a “Child class,” while a In Java, a good example is observed
class that whose properties are inherited in different banks in offering different
is referred to as a “Parent class. Use the interest rates. Use the relevant material
relevant material or resources, including or resources, including library search,
library search, explore other issues or explore other issues or things that are
things that are examples of inheritance. examples of polymorphism.
Deliverable: Deliverable:
Summary report that includes sketches Summary report that includes sketches
and photographs. and photographs.
Document your findings in a portifolio Document your findings in a portifolio
describing in details how they are describing in details how they are
regarded as abstraction. regarded as polymorphism.
314
for Advanced Secondary Schools
Computer Science Form 5.indd 314 23/07/2024 12:34

