I wanna to use multiple inheritance and I got to know Interface might give me help, so I create the following coding
namespace IT.Machine
{
interface IMachine: IMachineA, IMachineB, IMachineC
{
public int MachineID { get; set; }
public int CategoryID { get; set; }
}
}
namespace IT.Machine
{
interface IMachineA
{
public int ID { get; set; }
public string A01 { get; set; }
public string A02 { get; set; }
public string A03 { get; set; }
}
}
namespace IT.Machine
{
interface IMachineB
{
public int ID { get; set; }
public string B01 { get; set; }
public string B02 { get; set; }
public string B03 { get; set; }
}
}
namespace IT.Machine
{
interface IMachineC
{
public int ID { get; set; }
public string C01 { get; set; }
public string C02 { get; set; }
public string C03 { get; set; }
}
}
private void btnTesting_Click(object sender, EventArgs e)
{
Machine.IMachine machine = new Machine.IMachine();
machine.A01 = "string for A01";
machine.A02 = "string for A02";
machine.B01 = "string for B01";
machine.C03 = "string for C03";
machine.CategoryID = 9999;
machine.MachineID = 123;
}
However, I got errors, for example...The modifier 'public' is not valid for this item in every "public". May I know how I can fix this error? Please advice the correct way to use "Interface" in this situation.
Please help...