#include #include "HumanT.h" #include using namespace std; using HumanVec = vector ; void TellAboutHumans(const HumanVec & humans); int main() { HumanVec humans; //humans.push_back(new HumanT{"Anne"}); humans.push_back(new BardT{"Bob"}); humans.push_back(new MagicHumanT{"Chris"}); humans.push_back(new SingerT{"Dawn"}); humans.push_back(new CardUserT{"Ed"}); humans.push_back(static_cast (new SingingCardUserT{"Fran"})); TellAboutHumans(humans); for(auto & x: humans) { delete x; } return 0; } void TellAboutHumans(const HumanVec & humans) { BardT * bard; MagicHumanT * magic; cout << endl; for (auto x : humans) { cout << "Here is a human: " << endl; cout << "\tGreeting " << x->Greet() << endl; if (nullptr != ( bard = dynamic_cast (x))) { cout << "\tThey can perform: " << bard->Perform() << endl; } if (nullptr != ( magic = dynamic_cast (x)) ) { cout << "\tThey can do tricks: " << magic->DoTricks() << endl; } cout << endl << endl; } return; }