TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Justus
NA
8
0
Class having itself as member
Jun 8 2008 1:43 PM
Hi,
i need a member of a class to be of the same type as the class itself. When i inherit the class, the member should be of the type of the inherited type.
class BaseClass { BaseClass member; }
and
class MyClass : BaseClasse { MyClass member;}
I can achieve this by making BaseClass generic:
class BaseClass<T> { T member; }
and
class MyClass : BaseClass<MyClass> {}
but is there a more elegant way?
Reply
Answers (
2
)
Data type Problem
SortedDictionary v.s. Dictionary