Possible Duplicate:
it is possible to change return type when override a virtual function in C++?C++ 나는 오류를 얻고있다
기본 클래스에서 다른 반환 값의 형태와 재정 기능 : 난 내 코드를 컴파일
error: conflicting return type specified for âvirtual bool D::Show()
7: error: overriding âvirtual void A::Show()"
. 코드는 다음과 같습니다.
class A
{
public:
virtual void Show()
{
std::cout<<"\n Class A Show\n";
}
};
class B : public A
{
public:
void Show(int i)
{
std::cout<<"\n Class B Show\n";
}
};
class C
{
public:
virtual bool Show()=0;
};
class D :public C, public B
{
public:
bool Show(){
std::cout<<"\n child Show\n";
return true;}
};
int main()
{
D d;
d.Show();
return 0;
}
클래스 C의 Show() 함수를 사용하고 싶습니다. 어디 까지나 오류가 있습니까?
http://stackoverflow.com/a/4222307/1231073 – sgarizvi