Note: (Restricted functionality due to obvious reasons!)
Minimal Code ( Raw-View ) :
#include<iostream.h>
#include<conio.h>
class Human{
public :
int age, height, weight;
int sayage(){
cout<<"my age is "<< age;
return age;
}
virtual char sayGender() = 0;
};
class Boy : public Human {
public:
char gender;
Boy(){gender = 'M' ;}
char sayGender(){
cout<<"\n My Gender : "<<gender<<endl;
return gender;
}
};
class Girl : public Human{
public:
char gender;
Girl(){gender = 'F' ;}
char sayGender(){
cout<<"\n My Gender : "<<gender<<endl;
return gender;
}
};
void main(){
Girl g, g1;
Boy b;
Human *h;
char choice;
cout<<" Enter choice (which type of human is required) : " ;
cin>>choice;
if(choice == 'b'){ h=&b;}
else{ h = &g;}
h->sayGender();
}