0% found this document useful (0 votes)
16 views

Inheritance

this contain information about inheritance of oop in cpp

Uploaded by

Huriza Tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Inheritance

this contain information about inheritance of oop in cpp

Uploaded by

Huriza Tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 74

Inheritance

1
What Is Inheritance?
• Provides a way to create a new class from an
existing class
• The new class is a specialized version of the
existing class

2
Why and When to use Inheritance in C++?

• use inheritance in C++ for the reusability of


code from the existing class. C++ strongly
supports the concept of reusability.
• Reusability is yet another essential feature of
OOP(Object Oriented Programming).

CS1 -- Inheritance and Polymorphism 3


Example: Insect Taxonomy

CS1 -- Inheritance and Polymorphism 4


Types of inheritance in C++

5
Single Inheritance in C++:
• When the derived class inherits only one base
class, it is known as Single Inheritance.

6
The "is a" Relationship
• Inheritance establishes an "is a"
relationship between classes.
– A car is a vehicle
– A flower is a plant
– A football player is an athlete

7
Example
class Base {
public:
float salary = 900;
};
class Derived: public Base {
public:
float bonus = 100;
void sum() {
cout << "Your Total Salary is: " << (salary + bonus) << endl;
}
};
int main() {
// Creating an object of the derived class.
Derived x;
Your Salary is: 900
Your Bonus is: 100
// Gets the salary variable of Base class.
cout << "Your Salary is:" << x.salary << endl;
Your Total Salary is: 1000
// Gets the bonus variable of the Derived class.
cout << "Your Bonus is:" << x.bonus << endl;
x.sum();
return 0;
}

8
Example-02
#include <iostream>

// Base class int main() {


class Shape { Rectangle rectangle;
public:
void setWidth(int w) { // Set dimensions using base class methods
width = w; rectangle.setWidth(5);
} rectangle.setHeight(10);

void setHeight(int h) { // Access width and height using base class protected
height = h; members
} std::cout << "Width: " << rectangle.width << std::endl;
std::cout << "Height: " << rectangle.height << std::endl;
protected:
int width; // Calculate and print the area using the derived class method
int height; std::cout << "Area: " << rectangle.getArea() << std::endl;
};
// Derived class inheriting from Shape return 0;
class Rectangle : public Shape { }
public:
int getArea() {
return width * height;
}
}; 9
Class Task
• Create a C++ program with a base class Person and a
derived class Student using single inheritance.
• The Person class should store basic information such
as name and age, while the Student class, inheriting
from Person, should include details like student ID
and GPA. Implement constructors to initialize the
data and display functions to output the information.
Demonstrate the relationship by creating an object
of the Student class in the main function and
showcasing the details using class methods.

10
Inheritance – Terminology and Notation in
C++
• Base class (or parent) – inherited from
• Derived class (or child) – inherits from the base class
• Notation:
class Student // base class
{
. . .
};
class UnderGrad : public student
{ // derived class
. . .
};
CS1 -- Inheritance and Polymorphism 11
Back to the ‘is a’ Relationship
• An object of a derived class 'is a(n)' object of
the base class
• Example:
– an UnderGrad is a Student
– a Mammal is an Animal
• A derived object has all of the characteristics
of the base class

CS1 -- Inheritance and Polymorphism 12


What Does a Child Have?
An object of the derived class has:
• all members defined in child class
• all members declared in parent class

An object of the derived class can use:


• all public members defined in child class
• all public members defined in parent
class

CS1 -- Inheritance and Polymorphism 13


Protected Members and Class
Access
• protected member access
specification: like private, but
accessible by objects of derived class
• Class access specification: determines
how private, protected, and
public members of base class are
inherited by the derived class

CS1 -- Inheritance and Polymorphism 14


Class Access Specifiers
1) public – object of derived class can be
treated as object of base class (not vice-
versa)
2) protected – more restrictive than
public, but allows derived classes to know
details of parents
3) private – prevents objects of derived
class from being treated as objects of base
class.
CS1 -- Inheritance and Polymorphism 15
Inheritance vs. Access
How inherited base class
members
Base class members appear in derived class
private: x private x is inaccessible
protected: y base class
private: y
public: z private: z

private: x protecte x is inaccessible


protected: y d protected: y
base class
public: z protected: z

private: x public x is inaccessible


protected: y base class protected: y
public: z public: z
CS1 -- Inheritance and Polymorphism 16
Inheritance vs. Access
class Grade class Test : public Grade
private members: private members:
char letter; int numQuestions;
float score; float pointsEach;
void calcGrade(); int numMissed;
public members: public members:
void setScore(float); Test(int, int);
float getScore();
char getLetter();
private members:
int numQuestions:
When Test class inherits float pointsEach;
from Grade class using int numMissed;
public class access, it public members:
Test(int, int);
looks like this: void setScore(float);
float getScore();
char getLetter();

CS1 -- Inheritance and Polymorphism 17


Inheritance vs. Access
class Grade class Test : protected Grade
private members: private members:
char letter; int numQuestions;
float score; float pointsEach;
void calcGrade(); int numMissed;
public members: public members:
void setScore(float); Test(int, int);
float getScore();
char getLetter();
private members:
int numQuestions:
When Test class inherits float pointsEach;
from Grade class using int numMissed;
protected class access, it public members:
Test(int, int);
looks like this: protected members:
void setScore(float);
float getScore();
float getLetter();

CS1 -- Inheritance and Polymorphism 18


Inheritance vs. Access
class Grade class Test : private Grade
private members: private members:
char letter; int numQuestions;
float score; float pointsEach;
void calcGrade(); int numMissed;
public members: public members:
void setScore(float); Test(int, int);
float getScore();
char getLetter();
private members:
int numQuestions:
When Test class inherits float pointsEach;
from Grade class using int numMissed;
private class access, it void setScore(float);
float getScore();
looks like this: float getLetter();
public members:
Test(int, int);

CS1 -- Inheritance and Polymorphism 19


Constructors and Destructors in Base and
Derived Classes
• Derived classes can have their own
constructors and destructors
• When an object of a derived class is created,
the base class’s constructor is executed first,
followed by the derived class’s constructor
• When an object of a derived class is
destroyed, its destructor is called first, then
that of the base class

CS1 -- Inheritance and Polymorphism 20


Constructors and Destructors in Base and
Derived Classes

CS1 -- Inheritance and Polymorphism 21


Constructors and Destructors in Base and
Derived Classes

CS1 -- Inheritance and Polymorphism 22


Constructors and Destructors in Base and
Derived Classes

CS1 -- Inheritance and Polymorphism 23


Base Class

CS1 -- Inheritance and Polymorphism 24


Derived Class

Redefined setScore function

CS1 -- Inheritance and Polymorphism 25


Driver Program

CS1 -- Inheritance and Polymorphism 26


Multilevel Inheritance in C++

27
Multilevel Inheritance
Multilevel inheritance is a type of inheritance
where a class inherits from another class, which
in turn inherits from another class. This creates a
hierarchy of classes, with each class inheriting
properties and methods from its parent class. It
allows for the creation of more specialized
classes and promotes code reuse.

CS1 -- Inheritance and Polymorphism 28


Syntax of Multilevel Inheritance in C++
class base_classname
{
properties;
methods;
};

class intermediate_classname:visibility_mode base_classname


{
properties;
methods;
};

class child_classname:visibility_mode intermediate_classname


{
properties;
methods;
};

CS1 -- Inheritance and Polymorphism 29


Example

CS1 -- Inheritance and Polymorphism 30


#include <iostream>
int main() {
// Base class
// Creating an object of the most
class Animal {
public:
derived class (Dog)
void eat() { Dog myDog;
std::cout << "Animal is eating." << std::endl;
} // Accessing methods from the base
}; class
myDog.eat();
// Derived class 1
class Mammal : public Animal { // Accessing methods from the
public:
intermediate class (Mammal)
void run() {
myDog.run();
std::cout << "Mammal is running." << std::endl;
}
}; // Accessing methods from the most
derived class (Dog)
// Derived class 2 (inherits from Mammal) myDog.bark();
class Dog : public Mammal {
public: return 0;
void bark() { }
std::cout << "Dog is barking." << std::endl;
}
}; 31
Class Task
You are developing a program to manage information about animals in a zoo. There are different types of
animals, and you want to represent them using a class hierarchy. Consider the following classes: Animal,
Mammal, and Bird.

Animal Class:

Animal is the base class with properties like name and methods like eat() and sleep().
Mammal Class (inherits from Animal):

Mammal is derived from Animal and includes additional behaviors like giveBirth() and makeSound().
Bird Class (inherits from Animal):

Bird is derived from Animal and includes additional behaviors like layEggs() and fly().
Create a Dog Class (inherits from Mammal):

Dog is derived from Mammal and includes a specific behavior, bark().

In the main program, instantiate an object of the Dog class, name it "Rex," and demonstrate its ability to
perform actions inherited from the various classes in the hierarchy.

CS1 -- Inheritance and Polymorphism 32


Hierarchical Inheritance in C++

CS1 -- Inheritance and Polymorphism 33


Hierarchical Inheritance in C++
• Hierarchical Inheritance in C++ is that in which
a Base class has many sub classes or when a
Base class is used or inherited by many sub
classes. Thus when more than one classes are
derived from a single base class, such
inheritance is known as Hierarchical
Inheritance, where features that are common
in lower level are included in parent class.

CS1 -- Inheritance and Polymorphism 34


Syntax
class A
{
// body of the class A.
}
class B : public A
{
// body of class B.
}
class C : public A
{
// body of class C.
}
class D : public A
{
// body of class D.
}

CS1 -- Inheritance and Polymorphism 35


Hierarchical inheritance
If a number of classes are derived from a single base class, it is called hierarchical
inheritance.

36
#include<iostream>
using namespace std;
Example
class base{
public:
base(){
cout<<"Base class"; }
};
class childA:public base {
public:
childA(){
cout<<" Child A"; }
};
class childB:public base {
public:
childB(){
cout<<" Child B";
}
};
int main(){
childA obja;
cout<<"\n";
childB objb;
}
Example-02

38
Class Task
You are developing a library management system in C++. The system should handle
information about various types of materials, including books and DVDs. Both books
and DVDs have common attributes such as a title, author/director, and publication
year. However, they also have specific attributes unique to each type.

Design a base class called Material that includes common attributes and methods for
both books and DVDs. Ensure that it has a constructor to initialize common attributes.
Create two derived classes, Book and DVD, which inherit from the Material class. Each
derived class should have additional attributes specific to books and DVDs,
respectively.
Implement a function in each derived class that displays information about the
material. For example, the function in the Book class might display information like
title, author, publication year, and the number of pages, while the function in the DVD
class might display title, director, publication year, and duration.
In the main function, create instances of both the Book and DVD classes and
demonstrate the use of inheritance by calling the display function for each type of
material.

39
Multiple Inheritance in C++
• In C++ programming, a class can be derived
from more than one parents. When a class is
derived from two or more base classes, such
inheritance is called Multiple Inheritance.
Multiple Inheritance in C++ allow us to
combine the features of several existing
classes into a single class.

CS1 -- Inheritance and Polymorphism 40


Multiple Inheritance in C++

CS1 -- Inheritance and Polymorphism 41


Syntax of Multiple Inheritance
class base_class1
{
properties;
methods;
}; class derived_classname : visibility_mode base_class1,
visibility_mode base_class2,... ,visibility_mode
class base_class2 base_classN
{ {
properties; properties;
methods;
methods; };
};
... ... ...
... ... ...
class base_classN
{
properties;
methods;
}; CS1 -- Inheritance and Polymorphism 42
CS1 -- Inheritance and Polymorphism 43
#include <iostream> Example-2
class A {
public:
void displayA() {
std::cout << "Class A\n"; int main() {
} C obj;
}; obj.displayA();
obj.displayB();
class B { obj.displayC();
public:
void displayB() { return 0;
std::cout << "Class B\n"; }
}
};

class C : public A, public B {


public:
void displayC() {
std::cout << "Class C\n";
}
}; CS1 -- Inheritance and Polymorphism 44
Example-03
Value of X =20
VALUE of Y= 30
X1 = 100
y2 = 200

45
Ambiguity in Multiple Inheritance
• In multiple inheritance, a single class is
derived from two or more parent classes. So,
there may be a possibility that two or more
parents have same named member function.
If the object of child class needs to access one
of the same named member function then it
results in ambiguity. The compiler is confused
as method of which class to call on executing
the call statement.
CS1 -- Inheritance and Polymorphism 46
Ambiguity in Multiple Inheritance

CS1 -- Inheritance and Polymorphism 47


Ambiguity Solution
• This problem can be solved using scope
resolution(::) function to specify which
function to class either base1 or base2

CS1 -- Inheritance and Polymorphism 48


Class Task
Create two classes named Mammals and MarineAnimals.
Create another class named BlueWhale which inherits both
the above classes. Now, create a function in each of these
classes which prints "I am mammal", "I am a marine animal"
and "I belong to both the categories: Mammals as well as
Marine Animals" respectively. Now, create an object for
each of the above class and try calling
1 - function of Mammals by the object of Mammal
2 - function of MarineAnimal by the object of MarineAnimal
3 - function of BlueWhale by the object of BlueWhale
4 - function of each of its parent by the object of BlueWhale

CS1 -- Inheritance and Polymorphism 49


Class Task -02
• Make a class named Fruit with a data member
to calculate the number of fruits in a basket.
Create two other class named Apples and
Mangoes to calculate the number of apples
and mangoes in the basket. Print the number
of fruits of each type and the total number of
fruits in the basket.

CS1 -- Inheritance and Polymorphism 50


Home Task-02
• We want to calculate the total marks of each student
of a class in Physics,Chemistry and Mathematics and
the average marks of the class. The number of
students in the class are entered by the user. Create
a class named Marks with data members for roll
number, name and marks. Create three other classes
inheriting the Marks class, namely Physics, Chemistry
and Mathematics, which are used to define marks in
individual subject of each student. Roll number of
each student will be generated automatically.

CS1 -- Inheritance and Polymorphism 51


Home Task-03
• We want to store the information of different vehicles. Create a class
named Vehicle with two data member named mileage and price. Create
its two subclasses
• *Car with data members to store ownership cost, warranty (by years),
seating capacity and fuel type (diesel or petrol).
• *Bike with data members to store the number of cylinders, number of
gears, cooling type(air, liquid or oil), wheel type(alloys or spokes) and fuel
tank size(in inches)
• Make another two subclasses Audi and Ford of Car, each having a data
member to store the model type. Next, make two subclasses Bajaj and
TVS, each having a data member to store the make-type.
• Now, store and print the information of an Audi and a Ford car (i.e. model
type, ownership cost, warranty, seating capacity, fuel type, mileage and
price.) Do the same for a Bajaj and a TVS bike.
CS1 -- Inheritance and Polymorphism 52
Home Task-04
• Create a class named Shape with a function that prints
"This is a shape". Create another class named Polygon
inheriting the Shape class with the same function that
prints "Polygon is a shape". Create two other classes
named Rectangle and Triangle having the same function
which prints "Rectangle is a polygon" and "Triangle is a
polygon" respectively. Again, make another class named
Square having the same function which prints "Square
is a rectangle".
• Now, try calling the function by the object of each of
these classes.
CS1 -- Inheritance and Polymorphism 53
Hybrid Inheritance

54
Hybrid Inheritance
• Hybrid Inheritance is the combination of two
or more inheritances : single, multiple,
multilevel or hierarchical Inheritances.

CS1 -- Inheritance and Polymorphism 55


Example

CS1 -- Inheritance and Polymorphism 56


Diamond problem in C++

57
Diamond problem

Output??

58
OUTPUT

59
How can this problem be solved?

The above problem can be solved by


writing the keyword virtual. When we
use virtual keyword, it is called virtual
inheritance. When we use virtual
inheritance, we are guaranteed to get
only a single instance of the common
base class.

60
61
Types of Inheritance
Type of Inheritance Definition Example
A derived class inherits from only class Animal { /* ... */ }; class Mammal :
Single Inheritance
one base class. public Animal { /* ... */ };

class Base1 { /* ... */ }; class Base2 { /* ...


A derived class inherits from more
Multiple Inheritance */ }; class Derived : public Base1, public
than one base class.
Base2 { /* ... */ };

class Shape { /* ... */ }; class Circle : public


Hierarchical Multiple derived classes inherit from
Shape { /* ... */ }; class Square : public
Inheritance a single base class.
Shape { /* ... */ };

class Animal { /* ... */ }; class Mammal :


A derived class serves as the base
Multilevel Inheritance public Animal { /* ... */ }; class Dog : public
class for another derived class.
Mammal { /* ... */ };

class Base1 { /* ... */ }; class Base2 { /* ...


A combination of more than one */ }; class Derived1 : public Base1 { /* ... */ };
Hybrid Inheritance type of inheritance within a single class Derived2 : public Base2 { /* ... */ };
program. class HybridDerived : public Derived1,
public Derived2 { /* ... */ };

CS1 -- Inheritance and Polymorphism 62


Types of Inheritance

63
Single Inheritance-Questions
Type of Inheritance Example Home Task
1. How does single
inheritance help
maintain a clear and
simple class hierarchy?
2. In what situations is
single inheritance
preferable over multiple
inheritance?
3. Explain a real-world
cpp class Animal { /* ... */ }; scenario where single
Single Inheritance class Mammal : public inheritance is a suitable
Animal { /* ... */ }; design choice.
4. What challenges might
arise when using single
inheritance, and how
can they be addressed?
5. How does the base
class's functionality
contribute to the derived
class in a single
inheritance scenario? 64
Multiple Inheritance
1. Describe a scenario
where multiple
inheritance is beneficial
for code reuse.
2. What precautions
should be taken to
avoid ambiguity in
multiple inheritance?
3. How does multiple
cpp class Base1 { /* ... */ }; inheritance support the
class Base2 { /* ... */ }; class development of a
Multiple Inheritance
Derived : public Base1, diverse class hierarchy?
public Base2 { /* ... */ }; 4. Explain a situation
where multiple
inheritance might lead
to complex relationships
between classes.
5. What are the
advantages and
challenges of using
multiple inheritance in
software design?

65
Hierarchical Inheritance

1. In what contexts does


hierarchical inheritance
provide a clear
representation of
relationships? 2. How can
hierarchical inheritance
enhance code maintenance
and organization? 3.
cpp class Shape { /* ... */ }; Describe a situation where
class Circle : public Shape adding a new derived class
Hierarchical Inheritance
{ /* ... */ }; class Square : becomes straightforward due
public Shape { /* ... */ }; to hierarchical inheritance. 4.
Discuss potential challenges
and drawbacks of using
hierarchical inheritance. 5.
Explain how the base class
in hierarchical inheritance
encapsulates common
functionality for derived
classes

CS1 -- Inheritance and Polymorphism 66


Multilevel Inheritance

1. Provide an example of a
real-world scenario where
multilevel inheritance
accurately models
relationships. 2. How does
multilevel inheritance
contribute to the organization
and structure of a program? 3.
cpp class Animal { /* ... */ };
Discuss the impact of changes
class Mammal : public Animal {
Multilevel Inheritance in the base class on derived
/* ... */ }; class Dog : public
classes in multilevel
Mammal { /* ... */ };
inheritance. 4. What
challenges may arise when
implementing multilevel
inheritance, and how can they
be addressed? 5. Explain the
advantages of using multilevel
inheritance for code readability
and maintenance.

CS1 -- Inheritance and Polymorphism 67


Hybrid Inheritance
1. How does hybrid
inheritance offer a
combination of features from
different types of inheritance?
2. Provide a scenario where
hybrid inheritance is
cpp class Base1 { /* ... */ };
advantageous in modeling
class Base2 { /* ... */ }; class
complex relationships. 3.
Derived1 : public Base1 {
Discuss potential challenges
/* ... */ }; class Derived2 :
Hybrid Inheritance in maintaining code clarity
public Base2 { /* ... */ }; class
and preventing ambiguity in
HybridDerived : public
hybrid inheritance. 4. Explain
Derived1, public Derived2 { /*
the role of each base class in
... */ };
a hybrid inheritance scenario.
5. In what situations should
hybrid inheritance be chosen
over other types of
inheritance for a more flexible
class structure?

CS1 -- Inheritance and Polymorphism 68


Home Task+ Lab Task
Hospital Management System
Develop a comprehensive system for managing a hospital.
Create a class hierarchy representing different types of medical
staff, including doctors, nurses, and administrative staff. Utilize
inheritance to capture common attributes and behaviors, such as
scheduling, patient interactions, and medical expertise.

69
Classes in the Hospital Management System:
Person Class:
Attributes: name, age
Methods: displayDetails()
Explanation: The Person class serves as the base class for both doctors and patients. It encapsulates common
attributes like name and age. The displayDetails() method can be overridden in derived classes to show specific
details for doctors and patients.
Doctor Class (Derived from Person):

Additional Attributes: specialization


Additional Methods: prescribeMedication(), conductExamination()
Explanation: The Doctor class inherits from the Person class and adds attributes like specialization. It includes
methods specific to doctors, such as prescribing medication and conducting medical examinations.
Patient Class (Derived from Person):

Additional Attributes: ailment


Additional Methods: requestAppointment(), undergoTreatment()
Explanation: The Patient class inherits from the Person class and includes attributes like ailment. It includes
methods specific to patients, such as requesting an appointment and undergoing treatment.
Hospital Class:

Attributes: patients (a list of patients)


Methods: admitPatient(), assignDoctor(), displayPatientDetails()
Explanation: The Hospital class manages patient-related operations. It can admit patients, assign doctors to
patients, and display patient details. The patients attribute stores a list of patients currently admitted to the
hospital.
CS1 -- Inheritance and Polymorphism 70
Scenario-Based Questions
Doctor-Patient Interaction:
Question: Explain how the design allows for interactions between doctors and patients within the
hospital management system.

Extending the System:


Question: If you were to extend this system, how would you add more specialized roles or
functionalities, such as nurses, administrative staff, or specialized medical equipment?

Data Privacy and Security:


Question: Discuss how you would address concerns related to patient data privacy and security in
the hospital management system.

Adding New Features:


Question: Suppose the hospital wants to add a feature for billing and insurance. How would you
extend the existing system to incorporate billing information and insurance details?

Handling Emergency Cases:


Question: How does the design accommodate emergency cases, where immediate attention from
a doctor is required? Discuss any modifications needed to handle such situations effectively.
71
Online Shopping System
Develop a system for an online shopping platform.
Implement a class hierarchy for products, including
categories like electronics, clothing, and books. Use
inheritance to represent common attributes of
products and specialized behavior for each category.

72
Classes in the Online Shopping System:
Product Class (Base Class):
Attributes: productId, productName, price
Methods: displayDetails()
Explanation: The Product class is the base class for all products. It encapsulates common attributes such as
productId, productName, and price. The displayDetails() method can be overridden in derived classes to show
specific details for each product category.
Electronics Class (Derived from Product):
Additional Attributes: brand, warrantyPeriod
Additional Methods: checkWarranty(), displayDetails()
Explanation: The Electronics class inherits from the Product class and adds attributes like brand and
warrantyPeriod. It includes methods specific to electronics, such as checking the warranty period and displaying
details.
Clothing Class (Derived from Product):
Additional Attributes: size, material
Additional Methods: getSizeAvailability(), displayDetails()
Explanation: The Clothing class inherits from the Product class and adds attributes like size and material. It
includes methods specific to clothing, such as checking size availability and displaying details.
Books Class (Derived from Product):
Additional Attributes: author, genre
Additional Methods: getAuthorDetails(), displayDetails()
Explanation: The Books class inherits from the Product class and adds attributes like author and genre. It
includes methods specific to books, such as fetching author details and displaying book details.

CS1 -- Inheritance and Polymorphism 73


Scenario-Based Questions
Product Listing and Display:
Question: Explain how the class hierarchy allows for the effective listing and display of different
products on the online shopping platform. Discuss the role of the displayDetails() method.
Adding a New Product Category:
Question: Suppose the online shopping platform wants to add a new category, such as sports
equipment. How would you extend the existing class hierarchy to incorporate this new category?
What attributes and methods would you add?
Discounts and Special Offers:
Question: Discuss how you might introduce discounts or special offers in the system. How could this
be implemented in the base class, and how would it affect the derived classes?
Search and Filtering:
Question: How would you implement a search and filtering mechanism on the online shopping
platform based on product attributes? Consider attributes like brand, size, author, etc.
Handling Returns:
Question: In the context of an online shopping system, how would you design a mechanism to
handle product returns? Discuss any modifications needed to the existing class hierarchy.

CS1 -- Inheritance and Polymorphism 74

You might also like