The subject line probably isn't the best, but I don't know how else to
describe my question.
When I try to compile the code below, my compiler reports an error
(error text is below code sample).
class GrandParent {
virtual void doSomething() = 0;
};
class Parent : public GrandParent {
void doSomething() { std::cout << "blah"; }
};
class Child : public Parent {
bool doSomething() {
Parent::doSomet hing();
return true;
}
}
Error text is:
error C2555: 'Child::doSomet hing': overriding virtual function return
type differs and is not covariant from 'Parent::doSome thing'
I thought that since Parent's function isn't virtual, I should be able
to define an entirely unrelated function in Child that just happens to
have the same name. Is my compiler being overly picky or am I wrong?
Thanks.