-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathanimal.cpp
More file actions
93 lines (68 loc) · 2.1 KB
/
animal.cpp
File metadata and controls
93 lines (68 loc) · 2.1 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using namespace std ;
#include "animal.h"
string Animal::about() const {
stringstream ss;
ss << "Animal_color = " << " " << Animal_color;
return ss.str();
};
string Mammal::about() const {
stringstream ss;
ss << Animal::about() << " " << " gender = " << " " << gender;
return ss.str();
};
string Predator::about() const {
stringstream ss;
ss << Animal::about() << " " << " omnivorous = " << " " << omnivorous;
return ss.str();
};
string Whales::about() const {
stringstream ss;
ss << Mammal::about() << " " << " opportunity_to_get_out_of_the_water = " << " " << opportunity_to_get_out_of_the_water;
return ss.str();
};
string Dog::about() const {
stringstream ss;
ss << Mammal::about() << " " << " Tail_length = " << " " << Tail_length;
return ss.str();
};
string Husky::about() const {
stringstream ss;
ss << Dog::about() << " " << " Average_length_of_wool = " << " " << Average_length_of_wool;
return ss.str();
};
string Pug::about() const {
stringstream ss;
ss << Dog::about() << " " << " Leg_length = " << " " << Leg_length;
return ss.str();
};
int main(){
Pug pes_Solnyshk0;
Husky sobaka_Marta;
Dog Sam;
Whales Dolphin;
Predator Bears;
pes_Solnyshk0.gender = true;
pes_Solnyshk0.Animal_color = "yellow";
pes_Solnyshk0.Leg_length = 10;
pes_Solnyshk0.Tail_length = 5;
sobaka_Marta.Average_length_of_wool = 5;
sobaka_Marta.gender = false;
sobaka_Marta.Animal_color = "white";
sobaka_Marta.Tail_length = 20;
Sam.gender = true;
Sam.Tail_length = 15;
Sam.Animal_color = "black";
Dolphin.opportunity_to_get_out_of_the_water = false;
Dolphin.Animal_color = "blue";
Dolphin.gender = true;
Bears.Animal_color = "brown";
Bears.gender = true;
Bears.omnivorous = true;
cout << "-------------------------------------------------------------" << endl;
cout << "pes_Solnyshk0: " << pes_Solnyshk0.about() << endl;
cout << "sobaka_Marta: " << sobaka_Marta.about() << endl;
cout << "Sam: " << Sam.about() << endl;
cout << "Dolphin: " << Dolphin.about() << endl;
cout << "Bears: " << Bears.about() << endl;
cout << "-------------------------------------------------------------";
}