Thomas Hruska a écrit :
> class MyBase
> {
> public:
>    MyBase()  {}
>    virtual ~MyBase()  {}
>
>    virtual MyBase *Copy() const
>    {
>      return new MyBase(*this);
>    }
> };
>
> class MyBase2
> {
> public:
>    MyBase2()  {}
>    virtual ~MyBase2()  {}
>
>    virtual MyBase2 *Copy() const
>    {
>      return new MyBase2(*this);
>    }
> };
>
> class MyDerived : public MyBase, public MyBase2
> {
> public:
>    MyDerived()  {}
>    virtual ~MyDerived()  {}
>
>    virtual MyDerived *Copy() const
>    {
>      return new MyDerived(*this);
>    }
> };
>
> Without the ', public MyBase2' above, it compiles just fine.  With it, I 
> get (using VS.NET 2003 SP1):
>
> error C2511: 'MyBase2 *MyDerived::Copy(void)' : overloaded member 
> function not found in 'MyDerived'
>
> Point me at the right section in the Standard that says this is correct 
> behavior.  It seems like a bug to me.  Then again, I don't generally 
> derive from more than one class.  (This is a simplified case of 
> something much more complex - and I tested the above code before posting).
>
>   

Look for "covariant return".
If I am right, it come late in the standard so some compilers don't 
support it.

David

Reply via email to