Menu driven program to Create employee bio-data using following classes i) Personal record ii))Professional record iii) Academic record Assume appropriate data members and member function to accept required data & print bio-data. Create bio-data using multiple inheritance using C++ .

     MULTIPLE INHERITANCE


Multiple inheritances is a feature of some object-oriented computer programming languages in which an object or class can inherit characteristics and features from more than one parent object or parent class.



               Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses and subclasses. On calling the method, the compiler cannot determine which class method to be called and even on calling which class method gets the priority.

Create employee bio-data using following classes 
i) Personal record 
ii))Professional record 
iii) Academic record 
Assume appropriate data members and member function to accept required data & print bio-data. Create bio-data using multiple inheritance using C++.

PROGRAM
#include<iostream>
using namespace std;
class personal_record
{  protected:
   char name[40];
   double dob;
   char address[80];
  

};
class professional_record
{  protected:
float salary,exp;

   
 };
class acadimic_record:public personal_record,public professional_record
 {
protected:
int roll_no;
   int marks;
   int adm_no;

public:
    void accept()
  { 
    cout<<"ENTER\n";
    cout<<"name:";
    cin>>name;
    cout<<"dob:";
    cin>>dob;
    cout<<"address:";
    cin>>address;
    cout<<"roll_no:";
    cin>>roll_no;
    cout<<"marks:";
    cin>>marks;
    cout<<"adm_no:";
    cin>>adm_no;
cout<<"salary";
cin>>salary;
cout<<"experience";
cin>>exp;
  }
    void display()
  { 
    
    cout<<"name:";
    cout<<name<<endl;
    cout<<"dob:";
    cout<<dob<<endl;
    cout<<"address:";
    cout<<address<<endl;
    cout<<"roll_no:";
    cout<<roll_no<<endl;
    cout<<"marks:";
    cout<<marks<<endl;
    cout<<"adm_no:";
    cout<<adm_no<<endl<<endl;
cout<<salary<<endl;
cout<<exp<<endl;
  }
   


};
int main()
{acadimic_record a[10];
int op,i=0,j;
do
{
cout<<"enter\n1.accept\n2.display\n3.exit\n";
cin>>op;
switch(op)
{
case 1:a[i].accept();
       i++;
       break;
case 2:for(j=0;j<i;j++)
       a[j].display();
       break;
}
}while(op!=3);
  return 0;
}

OUTPUT:


**********OUTPUT*********
enter
1.accept
2.display
3.exit
1
ENTER
name:abc
dob:23
address:ty
roll_no:23
marks:100
adm_no:2345
enter
1.accept
2.display
3.exit
2
name:abc
dob:23
address:ty
roll_no:23
marks:100
adm_no:2345

enter
1.accept
2.display
3.exit
3


No comments:

Post a Comment

If you have any problems related to solutions or any concept please let me know.

Copyright (c) 2020 Custom Programs All Right Reserved

Pages