OOCP2_8

//BCA Support //www.bcasupport.xyz #include <iostream.h> #include <conio.h> class publisher { protected: char title[20]; void input() { cout<<"\nEnter title name : "; cin>>title; } }; class book : publisher { int pages; public: void input() { publisher::input(); cout<<"Enter no. of pages : "; cin>>pages; } void display() { cout<<"\nTitle : "<<title; cout<<"\nNo. of pages : "<<pages; } }; class tape : publisher { int time; public: void input() { cout<<"Enter play time (minutes) : "; cin>>time; } void display() { cout<<"\nPlay time (minutes) : "<<time; } }; int main() { clrscr(); book b1; tape t1; b1.input(); t1.input(); cout<<"\nBook Details -"; b1.display(); t1.display(); getch(); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.