1
상속을 사용하여 같은 이름의 멤버에 액세스하는 방법에 대한 질문이 있습니다. 예를 들어, 예상속에서 같은 이름의 멤버에 액세스하는 방법
class Base {
public:
int i;
};
class Derived1 : public Base {
public:
int i;
// how to access the i in the base class here?
};
int main() {
Derived1 d;
cout<<d.i; //which is it is?
//how to access the different i here?
}
+1 질문에 답변하고 일반적으로 그렇게하는 것이 좋지 않다고 지적하면서 +1. –