我有这个代码片段
#include <iostream>
using namespace std;
class Polygon
{
public:
int publicmemberPolygon;
private:
int privatememberPolygon;
protected:
int protectedmemberPolygon;
};
class Square : public Polygon
{
public:
int Getter();
};
int Square::Getter()
{
return privatememberPolygon;
}
int main()
{
}
问题是,为什么 privatememberPolygon 无法访问?不是吗,当你有一个派生类时,它的所有成员/函数都被复制了吗?谢谢