هاااي قاايز..
كيف الحااال؟؟؟
عندي سؤااال بالInheritance
انا حاااولت وحليته بس المشكله ما عرفت أكمل
وهذا السؤااال..
Assume that the publisher in Exercises 1 and 3 decides to add a third way to distribute
books: on computer disk, for those who like to do their reading on their laptop. Add a
disk class that, like book and tape, is derived from publication. The disk class should
incorporate the same member functions as the other classes. The data item unique to this
class is the disk type: either CD or DVD. You can use an enum type to store this item.
The user could select the appropriate type by typing c or d.
وهذا حلللي..
class publication
{
private:
string title;
float price;
public:
void getdata()
{
cout << "\n Enter title (one word only): ";
cin >> title;
cout << " Enter price: ";
cin >> price;
}
void putdata()
{
cout << "\n Title: " << title;
cout << "\n Price: " << price;
}
};
class book : private publication
{
private:
int pages;
public:
void getdata()
{
publication::getdata();
cout << " Enter number of pages: ";
cin >> pages;
}
void putdata()
{
publication::putdata();
cout << "\n Pages: " << pages;
}
};
class tape : private publication
{
private:
float time;
public:
void getdata()
{
publication::getdata();
cout << " Enter playing time: "; cin >> time;
}
void putdata()
{
publication::putdata();
cout << "\n Playing time: " << time;
}
};
class disk : private publication
{
private:
disktype type;
public:
void getdata();
void putdata()



