Someone Please tell me what i'm doing wrong
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#include <iostream>
using namespace std;
class Creature
{
public:
Creature(int health = 100);
virtual void Greet() const = 0;
virtual void Display_Health() const;
protected:
int m_Health;
};
Creature::Creature(int health)
{
m_Health = health;
}
void Creature::Display_Health() const
{
cout<<"Health: " <<m_Health<<endl;
}
class Orc : public Creature
{
public:
Orc(int health = 155);
void Greet() const
{
cout<<"The orc grunts and says Hello\n";
}
void Display_Health() const
{
cout<<"Orc's Health: " <<m_Health<<endl;
}
};
Orc::Orc(int health):
Creature(health)
{}
class Dragon : public Creature // says error here?
{
public:
Dragon(int health = 1000);
void Greet() const
{
cout<<"The Dragon blows a puff of smoke at you\n";
}
void Display_Health() const
{
cout<<"Dragon's Health: " <<m_Health<<endl;
}
}
Dragon::Dragon(int health):
Creature(health)
{}
int main()
{
Creature* Crt = new Orc();
Creature* Crt2 = new Dragon();
Crt -> Greet();
Crt -> Display_Health();
Crt2 -> Greet();
Crt2 -> Display_Health();
int k;
cin>>k;
return 0;
}
|
pretty sure it's just another stupid mistake... Thanks for replying.
Line 49, missing semicolon.
Line 49, missing semicolon. |
Looooooooool, feel so retarded right now. Thanks dude.
Topic archived. No new replies allowed.