DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Programming in C++
*****************************************************
#Post#: 25--------------------------------------------------
HYBRID INHERITANCE
DIR By: gaurav
Date: May 12, 2019, 11:00 pm
---------------------------------------------------------
#include<iostream.h>
#include<conio.h>
class A
{
public: char name[100];
};
class B: public A
{
public: int reg;
};
class C
{
public: char course[100];
};
class D: public B, public C
{
public: char inst[100];
public: void input()
{
cout<<"\t\tHYBRID INHERITANCE\n";
cout<<"\n\tFILL THE DETAILS GIVEN BELOW:\n";
cout<<"Enter the name=>";
cin>>name;
cout<<"Enter the register number=>";
cin>>reg;
cout<<"Enter the course=>";
cin>>course;
cout<<"Enter the Institution=>";
cin>>inst;
}
void output()
{
cout<<"\n\tDETAILS GIBEN BELOW:\n";
cout<<"NAME=>"<<name<<"\n";
cout<<"REGISTER NUMBER=>"<<reg<<"\n";
cout<<"COURSE=>"<<course<<"\n";
cout<<"INSTITUTION=>"<<inst<<"\n";
}
};
void main ()
{
clrscr();
D obj;
obj.input();
obj.output();
getch();
}
*****************************************************
Page 1 of 1