R
Rahul
Hi Everyone,
I was trying to implement covariant return types and i get a
compilation error,
class BB : public AA
{
};
class A
{
public: virtual A* sample()
{
A obj;
return(&obj);
}
};
class B : public A
{
public: virtual B* sample()
{
B obj;
return(&obj);
}
};
'B::sample' : overriding virtual function differs from 'A::sample'
only by return type or calling convention
Am i missing something?
Thanks in advance!!!
I was trying to implement covariant return types and i get a
compilation error,
class BB : public AA
{
};
class A
{
public: virtual A* sample()
{
A obj;
return(&obj);
}
};
class B : public A
{
public: virtual B* sample()
{
B obj;
return(&obj);
}
};
'B::sample' : overriding virtual function differs from 'A::sample'
only by return type or calling convention
Am i missing something?
Thanks in advance!!!