Inheritance
Inheritance
int p_cnt;
public:
void getb(){
try
{
get();
cout<<"enter the page count:";
cin>>p_cnt;
if (p_cnt==0){
throw p_cnt;
}
}
catch(...){
cout<<"invalid page count:"<<endl;
p_cnt=0;
}
}
void putb(){
cout<<"page count is:"<<p_cnt<<endl;
}
};
class tape:public publication{
float p_time;
public:
void getp(){
cout<<"Enter the play time:";
cin>>p_time;
}
void putp(){
cout<<"play time is:"<<p_time<<endl;
}
};
int main(){
book b;
tape t;
cout<<"SHRUTI KIRAN JADE"<<endl;
b.getb();
b.putb();
t.getp();
t.putp();
return 0;