如果我们重新定义数据成员,类的实现会发生什么?例如,假设我们有:
class foo {
public:
int a;
char *b;
};
...
class bar : public foo {
public:
float c;
int b;
};
bar 对象的表示是否包含一个或两个 b 字段?如果有两个,它们都是可访问的,还是只有一个?在什么情况下?
如果我们重新定义数据成员,类的实现会发生什么?例如,假设我们有:
class foo {
public:
int a;
char *b;
};
...
class bar : public foo {
public:
float c;
int b;
};
bar 对象的表示是否包含一个或两个 b 字段?如果有两个,它们都是可访问的,还是只有一个?在什么情况下?