class foo{
protected:
int *data;
public:
int& operator[](int i);
int operator[](int i)const;
};
class goo : public foo{
int& operator[](int i)
{
foo::operator[](i);
}
int operator[](int i) const
{
foo::operator[](i);
}
};
부모 클래스 연산자를 호출하고 싶습니다.어떻게 부모 클래스 differnet 연산자를 호출 할 수
int& operator[](int i)
및
int operator[](int i)
하지만은 한 부모의 운영자 int& operator[](int i)
가 호출됩니다. 어떻게 수정해야합니까 ??
이 확인'INT 연산자 []'goo' const를'너무 (내가 INT). – songyuanyao
심지어 컴파일합니까? 반환 유형에만 과부하를 적용 할 수 없습니다. – LogicStuff
@songyuanyao 코드를 업데이트했습니다. –