Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class publication
- {
- private:
- char name[100];
- float cost;
- public:
- void getdata()
- {
- cout << "Name book" << endl;
- cin >> name;
- cout << "Cost book" << endl;
- cin >> cost;
- }
- void putdata()
- {
- cout << "Book:" << endl;
- cout << "Name - " << name << endl;
- cout << "Cost - " << cost << " $" << endl;
- }
- };
- class book : public publication
- {
- public:
- int tops;
- void gettops()
- {
- cout << "Write tops in the book" << endl;
- cin >> tops;
- }
- void puttops()
- {
- cout << tops << " - Tops" << endl;
- }
- };
- class type : public publication
- {
- public:
- float time;
- void gettime()
- {
- cout << "Write time book" << endl;
- cin >> time;
- }
- void puttime()
- {
- cout << "Time - " << time << " hours" << endl;
- }
- };
- int main()
- {
- publication obj;
- book obj1;
- type obj2;
- obj.getdata();
- obj.putdata();
- obj1.gettops();
- obj1.puttops();
- obj2.gettime();
- obj2.puttime();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement