-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiple.cpp
More file actions
72 lines (58 loc) · 1.09 KB
/
multiple.cpp
File metadata and controls
72 lines (58 loc) · 1.09 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
/*write a class called Pet
it inherits from both the class Patient and the class Dog
Pet has one private member: name
Pet has public getName and setName functions.*/
#include <iostream>
using namespace std;
//base: Patient
class Patient
{
private:
int idNumber;
public:
void setIdNumber(int idIn);
int getIdNumber();
};
void Patient::setIdNumber(int idIn){
idNumber=idIn;
}
int Patient::getIdNumber(){
return idNumber;
}
//base: Dog
class Dog
{
private:
string breed;
public:
void setBreed(string breedIn);
string getBreed();
};
void Dog::setBreed(string breedIn){
breed=breedIn;
}
string Dog::getBreed(){
return breed;
}
class Pet: public Dog, public Patient{
private:
string name;
public:
void setName(string name1);
string getName();
};
void Pet::setName(string name1){
name=name1;
}
string Pet::getName(){
return name;
}
int main()
{
Pet p1;
p1.setName("Kali");
p1.setIdNumber(44444);
p1.setBreed("Aussie");
cout<<p1.getName()<<" "<<p1.getIdNumber()<<" "<<p1.getBreed();
return 0;
}