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