Memory issues when inheriting

#include<iostream>
using namespace std;
class c{
private:
int real,imag;
public:
int a,b;
};
class ss:c
{
int aa;
};
int main()
{
ss a;
cout<<sizeof(a)<<endl;//Output 20(4*(2+2+1)) When inheriting, the private content of the father is also inherited. 
return 0;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326058246&siteId=291194637