-
January 15th, 2014, 02:47 PM
#1
Templates, multiple inheritance, and ambiguous overloads
Let's say I have a templated base class:
Code:
template <typename Input>
class Consumer
{
public:
void consume(Input input)
{
// do something
}
};
Now, I have a class which derives from this twice (A and B are unrelated, but otherwise unimportant classes):
Code:
class A;
class B;
class Derived: public Consumer<A>, public Consumer<B>
{
};
Now, elsewhere in the code I do this:
Code:
{
A myA;
Derived myDerived;
myDerived.consume(myA);
}
This looks like it should be simple enough, but g++ 4.8.1 is giving me a "request for member is ambiguous" error.
Any idea why?
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
|