-
Notifications
You must be signed in to change notification settings - Fork 0
/
8_5.cpp
59 lines (56 loc) · 948 Bytes
/
8_5.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "bits/stdc++.h"
using namespace std;
class shape
{
string shape_name;
public:
void get_data()
{
cin >> shape_name;
}
void print_data()
{
cout << "shape name = " << shape_name << endl;
}
};
class circle : public shape
{
float radius;
public:
void get_data()
{
cin >> radius;
}
float get_radius()
{
return radius;
}
void print_data()
{
cout << "radius = " << radius << endl;
}
};
class area : public circle
{
float area_of_circle;
public:
void get_data()
{
shape::get_data();
circle::get_data();
}
void print_data()
{
area_of_circle = get_radius() * get_radius() * 3.14;
shape::print_data();
circle::print_data();
cout << "area of circle is " << area_of_circle << endl;
}
};
int main()
{
area A;
A.get_data();
A.print_data();
return 0;
}