DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Programming in C++
*****************************************************
#Post#: 10--------------------------------------------------
MULTILEVEL INHERITANCE
DIR By: gaurav
Date: May 1, 2019, 12:54 pm
---------------------------------------------------------
#include<iostream.h>
#include<conio.h>
class parent
{
public: char name[100];
};
class child: public parent
{
public: int age;
};
class child1: public child
{
public: float height, weight;
child1()
{
cout<<"FILL THE DETAILS\n";
cout<<"Enter the name=";
cin>>name;
cout<<"Enter the age=";
cin>>age;
cout<<"Enter the height=";
cin>>height;
cout<<"Enter the weight=";
cin>>weight;
}
void output()
{
cout<<"\nDETAILS GIVEN BELOW\n";
cout<<"NAME="<<name<<"\n";
cout<<"AGE="<<age<<"\n";
cout<<"HEIGHT="<<height<<"\n";
cout<<"WEIGHT="<<weight<<"\n";
}
};
void main ()
{
clrscr();
child1 c1;
c1.output();
getch();
}
*****************************************************
Page 1 of 1