#include <iostream>
class Human {
private:
int height;
protected:
bool isFemale;
public:
Human(){};
Human(int height, bool isFemale = false) : height(height) {}
virtual ~Human(){}
};
class Female : public Human {
public:
Female(int height) : Human(height, true) {
std::cout << "I'm a new Female, my height is " << height << std::endl;
}
};
class Male : public Human {
public:
Male(int height) : Human(height, false) {
std::cout << "I'm a new Male, my height is " << height << std::endl;
}
};
int main() {
char gender;
Human h;
std::cout << " enter m/f: ";
std::cin >> gender;
switch(gender){
case 'm':
case 'M':
h = Male(186);
break;
case 'f':
case 'F':
h = Female(175);
break;
}
}