-
Notifications
You must be signed in to change notification settings - Fork 0
/
PUBLICATION
71 lines (66 loc) · 1.08 KB
/
PUBLICATION
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
#include<iostream>
#include<string>
using namespace std;
class Publication
{
private:
string title;
float price;
public:
void getData()
{
cout<<"\nEnter Title: ";
cin>>title;
cout<<"Enter Price: $";
cin>>price;
}
void putData()
{ cout<<"\nTitle: "<<title<<"\nPrice: "<<price;
}
};
class Book : public Publication
{
private:
int pages;
public:
void getData()
{
Publication::getData();
cout<<"Enter Pages: ";
cin>>pages;
}
void putData()
{
Publication::putData();
cout<<"\nPages: "<<pages;
}
};
class Tape : public Publication
{
private:
float minutes;
public:
void getData()
{
Publication::getData();
cout<<"Enter Minutes: ";
cin>>minutes;
}
void putData()
{
Publication::putData();
cout<<"\nMinutes: "<<minutes;
}
};
int main()
{
Book b; Tape t;
b.getData();
t.getData();
cout<<"\a"<<endl; // \a produces the beep sound
b.putData();
cout<<endl;
t.putData();
cout<<endl;
return 0;
}