-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSOAL4.cpp
75 lines (61 loc) · 1.34 KB
/
SOAL4.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
#include <string>
using namespace std;
class PersonData
{
private:
string name, address;
int phoneNumber;
public:
void setName(string name){
this->name = name;
}
string getName(){
return name;
}
void setAddress(string address){
this->address = address;
}
string getAddress(){
return address;
}
void setPhoneNumber(int phoneNumber){
this->phoneNumber = phoneNumber;
}
int getPhoneNumber(){
return phoneNumber;
}
};
class CustomerData : public PersonData
{
private:
int customerNumber;
bool mailingList;
public:
void setCustomerNumber(int customerNumber){
this->customerNumber = customerNumber;
}
int getCustomerNumber(){
return customerNumber;
}
void setMailingList(bool mailingList){
this->mailingList = mailingList;
}
int getMailingList(){
return mailingList;
}
};
int main() {
CustomerData cust;
cust.setCustomerNumber(005);
cust.setMailingList(true);
cust.setName("Harry");
cust.setAddress("Kediri,61842");
cust.setPhoneNumber(0324213);
cout<<"Customer Number : "<< cust.getCustomerNumber()<<endl;
cout<<"\nName : "<< cust.getName()<<endl;
cout<<"\nAddress : "<<cust.getAddress()<<endl;
cout<<"\nPhone : "<<cust.getPhoneNumber()<<endl;
cout<<"\nMailing List: "<<cust.getMailingList()<<endl;
return 0;
}