|
-
May 28th, 2013, 03:18 PM
#2
Re: Common base class + abstract interface class
 Originally Posted by Jordgubbe
I know that all objects that inherit MyInterface also inherit MyBaseclass, but the compiler doesn't know that. MyContainerclass wants to call methods in MyBaseclass, but it collects pointers to MyInterface classes. I can't make MyInterface inherit MyBaseclass,
You don't want to let MyInterface inherit MyBaseclass but maybe you could let MyInterface define a method which returns a pointer to MyBaseclass? Essentially that method just returns this.
With such a method you can use any MyInterface object as a MyBaseclass object too (as long as it is a MyBaseclass object of course).
Last edited by nuzzle; May 28th, 2013 at 03:25 PM.
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
|