Im learning as I go with a program I am writing. Im receiving and unexpected error and hoped someone could shine some light on as to why.
I am making a list of objects but when I try to add to the list I receive
(Invalid token '(' in class, struct, or interface member declaration)
My code follows...
protected List<Weapon> weap = new List<Weapon>();
weap.Add(new Weapon("Long Sword", 5));
Also the code for the class Weapon...
class Weapon
{
private string name = "Typed Name";
private int damage = 1;
public string Name { get { return name; } set { name = value; } }
public int Damage { get { return damage; } set { damage = value; } }
public void Weapon(string name, int damage)
{
this.name = name;
this.damage = damage;
}
}