MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

C++ language

A Simple Program On multilevel Inheritance
Previous Home Next
#include<iostream.h>
Class A
{
int a,b;
public :
void getdata()
{
cout<<"\n Enter the value of a and b";
cin>>a>>b;
}
void putdata()
{
cout<<"\n The value of a is :"<<a<<"and b :"<<b;
}
};
class B : public A     //class  is publicly derived from A
{
int c,d;
public :
void intdata()
{
cout<<"\n Enter the value of c and d :";
cin>>c>>d;
}
void outdata()
{
cout<<"\n The value of c ;"<<c<<"and d :"<<d;
}
};
class C: public B
{
int e,f;
public :
void input()
{
cout<<"\n Enter the value of e and f";
cin>>e>>f;
}
void output()
{
cout<<"\nthe value  of e is" <<e<<"and f is"<<f;
}
};
void main()
{
C obj;
obj.getdata();       //member function of class A
obj.indata();       //member function of class B
obj.input();        //member function of class C
obj.putdata();      //member function of class A
obj.outdata();      //member function of class B 
obj.output();       //member function of class C
}

output:

Enter the value of a and b
4
5
Enter the value of c and d
6
7
Enter the value of e and f
9
3
The value of a is 4 and b is 5
The value of c is 6 and d is 7
The value of e is 9 and f is 3
Previous Home Next