Polymorphism

I have problem to understand how even to start with this task... Output should be: Player <Robin> "Attacks!". The full code is more but I just cut out a small part to even understand how to start..... So the questions is how to write class Player and Creature?

code:

#include <iostream>
#include <string>

using namespace std;

class Creature
{
public:
Creature(string);
virtual void DoAction()const=0;
virtual void DrawOnScreen()const=0;
protected:
string CreatureName;
};


class Player: public creature

{
};

int main()
{
Player hero("Robin");
Creature* object[1];
object[0]=&hero;
object[0]->DrawOnScreen();
return 0;
}
return 0;
}
Topic archived. No new replies allowed.