Sep
09
#include<iostream.h>
class A{
protected:
int numA;
void inputA(){
cout<<“Enter Value for numA: “;
cin>>numA;
}
};
class B:public A{
protected:
int numB;
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 max(){
int temp;
temp=numA>numB?numA:numB;
temp=temp>numC?temp:numC;
cout<<“Greatest Number is: “<<temp<<endl;
}
};
void main(){
C c1;
c1.inputC();
c1.max();
}
Leave a Reply
No Comments