为什么int x可以不放在私有数据成员中?那x有什么意义?那通过什么方式访问x?

#include <iostream>
#include <string.h>
using namespace std;
class X {
    int x;
public:
    X() { x = 0; }
    X(int xx) { x = xx; }
    virtual void prt() { cout << x; }
};
class Y :public X {
    int y;
public:
    Y() { y = 0;  }
    Y(int yy) { y = yy; }
    void prt() { cout << y; }
};
int main()
{
    X x(10), z;
    Y y(11);
    z = x;
    z.prt();
    z = y;
    z.prt();
}

c++类默认是私有成员,结构体默认是共有

没有声明访问类型的,默认为是private