- Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathmulti-level-inheritance-cpp.cpp
More file actions
Latest commit
46 lines (39 loc) · 1013 Bytes
/
Copy pathmulti-level-inheritance-cpp.cpp
File metadata and controls
46 lines (39 loc) · 1013 Bytes
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
43
44
45
46
// Multi Level Inheritance
// Learn what multiple inheritance is and try to solve this problem.
//
// https://www.hackerrank.com/challenges/multi-level-inheritance-cpp/problem
//
#include<cmath>
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
usingnamespacestd;
classTriangle{
public:
voidtriangle(){
cout<<"I am a triangle\n";
}
};
classIsosceles : publicTriangle{
public:
voidisosceles(){
cout<<"I am an isosceles triangle\n";
}
};
// (template_head) ----------------------------------------------------------------------
//Write your code here.
classEquilateral : publicIsosceles{
public:
voidequilateral(){
cout<<"I am an equilateral triangle\n";
}
};
// (template_tail) ----------------------------------------------------------------------
intmain(){
Equilateral eqr;
eqr.equilateral();
eqr.isosceles();
eqr.triangle();
return0;
}