Quick Question

Started by
2 comments, last by brx 12 years, 3 months ago
Why doesn't this compile? Early morning, sorry for the stupidity.

Disregard this. I've figured it out. I've overworked my brain for today.



public class Calculations : Entity
{
public void DamageGenerator(Entity hero)
{
}
}

public class Battle
{
public Battle(Entity hero)
{
Calculations damGen = new Calculations(hero);
}
}
Advertisement
Where is the constructor of Calculations class that takes instance of Entity as argument?

Where is the constructor of Calculations class that takes instance of Entity as argument?


That's basically what I asked myself which led to me answering my own question. Like I said, early morning. I kind of preemptively posted.
The Calculations class does not have a constructor that takes an Entity as argument, actually it has no constructors at all except for the default generated one.

Compilers usually give you pretty detailed error messages. Posting that output along with the code makes it a lot easier for others to find the error especially if it's not as obvious as in this case.

Edit: Wow not only too slow to give the response, but also slower than the answer to that response.... it was close though ;)

This topic is closed to new replies.

Advertisement