forked from Jahanvi8210/C--programs
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti.cpp
More file actions
Latest commit
57 lines (52 loc) · 1.19 KB
/
Copy pathmulti.cpp
File metadata and controls
57 lines (52 loc) · 1.19 KB
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
#include<iostream>
usingnamespacestd;
classShape{
protected:
int measure1;
int measure2;
int area;
public:
voidacceptData(){
cout<<"Enter first measure:";
cin>>measure1;
cout<<"Enter second measure:";
cin>>measure2;
}
voidcalcArea(){
cout<<"Calculating area:"<<endl;
}
voidshowDetail(){
cout<<"Area of Shape is: "<<area<<endl;
}
};
classShapeColor{
protected:
char color[20];
public:
voidsetColor(){
cout<<"Enter the color of shape:"<<endl;
cin>>color;
}
voidshowDetail(){
cout<<"Shape color is: "<<color<<endl;
}
};
classRectangle:publicShape, publicShapeColor{
public:
voidcalcArea(){
Shape::calcArea();
area=measure1*measure2;
}
voidshowDetail(){
Rectangle r;
r.ShapeColor::showDetail();
r.Shape::showDetail();
}
};
intmain(){
Rectangle rect1;
rect1.acceptData();
rect1.setColor();
rect1.calcArea();
rect1.showDetail();
return0;}