Inheritance in C# multiple properties for a single property -
how inherit 1 class , have multiples of single property example
and here actual code (so far)
class networkinterface { public double vlan; public string ip; } class port : networkinterface { public double portnumber; } public void test () { port newport = new port(); newport.portnumber = 7; newport.vlan = 100 }
i want able add multiple interfaces 1 port
i don't think should using inheritance here.
if want port
contain collection of networkinterfaces
better definition of port
might be:
class port { public double portnumber; public networkinterface[] networkinterfaces; }
Comments
Post a Comment