Note: (Restricted functionality due to obvious reasons!)
Minimal Code ( Raw-View ) :
#include<iostream>
#include<conio.h>
using namespace std;
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 : Male "<<endl;
return gender;
}
};
class Girl : public Human{
public:
char gender;
Girl(){gender = 'F' ;}
char sayGender(){
cout<<"\n My Gender : Female "<<endl;
return gender;
}
};
int main(){
Girl g, g1;
Boy b;
Human * dconst h , h2;
char choice;
cout<<" Enter choice (which type of human is required) : " ;
cin>>choice;
if(choice == 'b'){ h=&b;}
else{ h = &g;}
h->sayGender();
getch();
return 29;
}