-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day_069.cpp
42 lines (35 loc) · 1004 Bytes
/
Day_069.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
*Problem Statement: Suppose, we have a class A which is the base class and we have a class B which is derived
from class A and we have a class C which is derived from class B, we can access the functions of both class A
and class B by creating an object for class C.Hence, this mechanism is called multi-level inheritance.
(B inherits A and C inherits B).Create a class called Equilateral which inherits from Isosceles and should have
a function such that the output is as given below.
*Author: Kunal Kathpal (https://github.com/kunal-2002)
*/
#include <bits/stdc++.h>
using namespace std;
class Isosceles{
public:
void display1(){
cout<<"I am an isosceles triangle\n";
}
};
class Equilateral : public Isosceles{
public:
void display2(){
cout<<"I am an Equilateral triangle\n";
}
};
class C : public Equilateral{
public:
void display3(){
cout<<"I am a triangle";
}
};
int main(){
C obj;
obj.display2();
obj.display1();
obj.display3();
return 0;
}