Multiple Inheritance

Program:


    #include<iostream.h> 
    #include<conio.h> 
class publishers { char pubname[30]; int pages; public: void getvalue(); void putvalue(); }; void publishers::getvalue() { cout<<"\n\n Enter the Publishers name : "; cin>>pubname; cout<<"\n\n Enter the No. of Pages : "; cin>>pages; } void publishers::putvalue() { cout<<"\n\n Publishers Name : "<<pubname; cout<<"\n\n Number of Pages : "<<pages; } class amount { float price; char edition[20]; public: void getdetail(); void putdetail(); }; void amount::getdetail() { cout<<"\n\n Enter the Book Price : "; cin>>price; cout<<"\n\n Enter Edition Number : "; cin>>edition; } void amount::putdetail() { cout<<"\n\n Book Price : "<<price; cout<<"\n\n Edition Number : "<<edition; } class bookdetail:public publishers,public amount { char bookname[30],author[30],bdate[10]; public: void getdetail1(); void putdetail1(); }; void bookdetail::getdetail1() { cout<<"\n\n Enter the Book Name : "; cin>>bookname; cout<<"\n\n Enter the Author Name : "; cin>>author; cout<<"\n\n Enter the Booking Date : "; cin>>bdate; getvalue(); getdetail(); } void bookdetail::putdetail1() { cout<<"\n\n Book Name : "<<bookname; cout<<"\n\n Author Name : "<<author; cout<<"\n\n Booking Date : "<<bdate; putvalue(); putdetail(); } void main() { clrscr(); bookdetail b; cout<<"\n\n\t\t Input Details"; cout<<"\n\t\t ************* "; b.getdetail1(); cout<<"\n\n\t\t Output "; cout<<"\n\t\t ****** "; b.putdetail1(); getch(); }
Powered by nasrullah.in - TechnoNasr 2003-2020.
Designed & Developed by Mohamed Nasrullah.M