#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class book
{
private:
char title[15];
float price;
int pon;
public:
void getdata()
{
cout<<"\nenter the title of book ";
cin>>title;
cout<<"\nprice of book";
cin>>price;
cout<<" no. of pages ";
cin>>pon;
}
void display()
{
cout<<"\ntitle "<<title;
cout<<" total pages "<<pon;
cout<<" price "<<price;
}
};
class sdetail:public book
{
private:
char agency[20];
int id;
public:
void getdata()
{
cout<<" agency name ";
gets(agency);
cout<<" registration number ";
cin>>id;
}
void display()
{
//book::display();
cout<<" agency name "<<agency;
cout<<" reg. no. "<<id;
}
};
void main()
{
clrscr();
class sdetail *p,*q,y;
class book x;
p=q;
p=(sdetail *) &x;
p->getdata();
p->display();
getch();
}
#include<conio.h>
#include<stdio.h>
class book
{
private:
char title[15];
float price;
int pon;
public:
void getdata()
{
cout<<"\nenter the title of book ";
cin>>title;
cout<<"\nprice of book";
cin>>price;
cout<<" no. of pages ";
cin>>pon;
}
void display()
{
cout<<"\ntitle "<<title;
cout<<" total pages "<<pon;
cout<<" price "<<price;
}
};
class sdetail:public book
{
private:
char agency[20];
int id;
public:
void getdata()
{
cout<<" agency name ";
gets(agency);
cout<<" registration number ";
cin>>id;
}
void display()
{
//book::display();
cout<<" agency name "<<agency;
cout<<" reg. no. "<<id;
}
};
void main()
{
clrscr();
class sdetail *p,*q,y;
class book x;
p=q;
p=(sdetail *) &x;
p->getdata();
p->display();
getch();
}