I'm designing an object model which needs a few constraints and I'm not sure how exactly to do what I want in C#, any help is appreciated.
Basically
The feature I need is to make sure that BGroup's collection only has B objects in it, but retains all the methods and members from AGroup.
While CGroups's collection only has C objects in it but has both A and B methods and members accessible.
Strong typing which gets stronger each level of inheritance.
Is this possible?
Thanks in advance,
Tyler Copple
Basically
Code:
Class A {...}
Class B : A {...}
Class C : B {...}
Class AGroup : Collection<A> {...}
Class BGroup : AGroup {...}
Class CGroup : BGroup {...}
The feature I need is to make sure that BGroup's collection only has B objects in it, but retains all the methods and members from AGroup.
While CGroups's collection only has C objects in it but has both A and B methods and members accessible.
Strong typing which gets stronger each level of inheritance.
Is this possible?
Thanks in advance,
Tyler Copple