Is there a way to have two children instances with one parent instance in c#?

I would like to know if what I asked in the title is possible since it would really help me out with an architectural idea of an application I am making.

And if it were possible..how would that work?

If I were to do parent = new Children1(); and then parent = new Children2(); It would override the data from children1..The purpose of this is that I want multiple children objects to hold the same basic data. It would be useful for example in the case of many children instances having to share one authentication token or id, the same session expiracy date, rights and so on.

Upvotes: 0

Views: 69

Answers (1)

Rahul
Rahul

Reputation: 77896

Create two separate parent type variable to hold the children references

 Parent parent1 = new Children1();

 Parent parent2 = new Children2();

Upvotes: 1

Related Questions