Sep
09
#include<iostream.h>
class A{
protected:
int numA;
public:
void inputA(){
cout<<“Enter Value for numA: “;
cin>>numA;
}
};
class B:public A{
protected:
int numB;
public:
void inputB(){
inputA();
cout<<“Enter Value for numB: “;
cin>>numB;
}
};
class C:public B{
protected:
int numC;
public:
void inputC(){
inputB();
cout<<“Enter Value for numC: “;
cin>>numC;
}
void showData(){
cout<<“numA = “<<numA<<endl;
cout<<“numB = “<<numB<<endl;
cout<<“numC = “<<numC<<endl;
}
};
void main(){
C c1;
c1.inputC();
c1.showData();
}
Leave a Reply
No Comments