Hi
I’ve created a class called IWeapon and when I try to make an array of it, I get the following error “Cannot apply indexing with to an expression of type ‘IWeapon’” can anyone tell me what is wrong please? Here are the scripts for IWeapon and IItem, which it inherits from
//IWeapon.cs
public class IWeapon : IItem
{
public enum Type
{
Sword, //0
Lance, //1
Staff, //2
Bow, //3
Axe, //4
Hammer, //5
};
public Type type;
public int atk;
public IWeapon()
{
}
public IWeapon(string wname, string wdesc, IWeapon.Type wtype, int watk)
{
itemName = wname;
description = wdesc;
type = wtype;
atk = watk;
}
}
//IItem.cs
public class IItem
{
public string itemName;
public string description;
public IItem()
{
}
public IItem(string iname, string idesc)
{
itemName = iname;
description = idesc;
}
}