![]() |
#2
thlgood2011-10-07 21:58
|

#include <iostream>
#include <string.h>
using namespace std;
class books
{
private:
char author[10];
float price;
public:
books(char *au, float pri)
{
strcpy(author, au);
price = pri;
}
void showprice()
{
cout << price <<endl;
}
};
class m:private books
{
private:
int id;
public:
m(char *au, float pri)
{
books(char *au, float pri);
}
void setid(int x)
{
id = x;
}
void showid()
{
cout << id << endl;
}
};
int main()
{
m abc("Yes", 2.5);
abc.setid(10);
// abc.showprice();
abc.showid();
return 0;
}