Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
4
Answers
Generics & Inheritence
Tyler Copple
16y
6.4k
1
Reply
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
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
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
can i get a tiny time interval like 0.01 ms?
Getting Started