You've got a number of problems here; let's deal one at once.
1. Your error is saying that the linker can't find where you've defined the body of the
MonsterCard::MonsterCard(void)
function (the default constructor).
If you look through your code, you'll find it's right - you've declared it at line 16, but never defined it.
So, one solution would be to define it. Another would be to remove the declaration; then the compiler will provide you with a default version - for free!
However, the question remains - why is the default constructor being used at all? You're calling the constructor that takes string and int parameters.
2. Your DarkMagician::DarkMagician() constructor is slightly malformed (line 83).
What you should have done was to use what's called an initialiser list and called the base-class constructor in that.
1 2 3 4
|
DarkMagician::DarkMagician() : MonsterCard("DarkMagician", 2500, 2000, 7)
{
// Any other initialisation can go here
}
|
As you wrote it, because you've not provided an
implicitexplicit base-class call, the compiler is automatically calling the default base class constructor for you, which is MonsterCard(void), and as we know - there's no body defined for that function.
Also, by writing what you did for that constructor, what you've effectively done is to construct the DarkMagician as a default MonsterCard (line 83) and then line 84 creates a local-scope MonsterCard instance which is then destructed again when the function returns.
Hope that helps!
Cheers
Jim