-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathinheritance-introduction.cpp
More file actions
42 lines (37 loc) · 958 Bytes
/
inheritance-introduction.cpp
File metadata and controls
42 lines (37 loc) · 958 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
// Inheritance Introduction
// Learn how to inherit classes from other classes.
//
// https://www.hackerrank.com/challenges/inheritance-introduction/problem
//
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Triangle{
public:
void triangle(){
cout<<"I am a triangle\n";
}
};
// (template_head) ----------------------------------------------------------------------
class Isosceles : public Triangle{
public:
void isosceles(){
cout<<"I am an isosceles triangle\n";
}
//Write your code here.
void description()
{
cout << "In an isosceles triangle two sides are equal" << endl;
}
};
// (template_tail) ----------------------------------------------------------------------
int main(){
Isosceles isc;
isc.isosceles();
isc.description();
isc.triangle();
return 0;
}