Answer the question
In order to leave comments, you need to log in
C#: Clarifying child class field type?
The problem is this: there is an abstract class A, its heirs: A1, A2, A3.
Abstract class B, its successors B1, B2, B3. Class B has a field of type A:
public abstract class B
{
public A field;
}
Is it possible to organize everything in such a way that in the child classes (B1, B2, B3), this field has the corresponding child type (A1, A2, A3)?
Hiding with new is not suitable, because you need the ability to access them through the base class (B).
Answer the question
In order to leave comments, you need to log in
stackoverflow.com/questions/5709034/does-c-sharp-s...
virtual (and\or generic) properties
Suitable or not - you know better.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question