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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -