|
-
January 22nd, 2010, 11:13 AM
#9
Re: Polymorphism; How to get the specific class?
 Originally Posted by Lindley
It's another way of saying "Don't try to apply the principals you may have learned in Java directly to C++. There are often better alternatives." But you know that, you're just being pedantic.
Sure, just because both Java and C# use an implicit top class doesn't mean the first thing you should do in C++ is to mimic that and introduce an Object class all your other classes inherit. I fully agree with that.
What I have problems with is when it's suggested that it somehow goes against the very nature of C++ to use a common top class. Nothing could be more wrong. If you think your design would benefit from a top class then C++ doesn't stand in your way. In fact the virtual inheritance mechanism makes it quite straightforward to have one.
Last edited by nuzzle; January 22nd, 2010 at 11:15 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|