派生类对象可以做到让基类的成员函数(因代码相同,未再派生类中重新定义)使用派生类的与基类同名的数据成员吗?

#include
using namespace std;
class Base{
int i;
public:
Base() {i = 1;}
void print() { cout << i << endl;}
};

class Derived : public Base{
int i;
public:
Derived() {i = 2;}
};

int main(){
Derived D;
D. print();
return 0;
}

如上,如何打印出派生类i2而不是基类i1,派生类没有重定义,调用基类的成员函数,用的是基类的i

在子类中必须重新print函数,基类访问子类是不可能的