struct AA
{
public:
int a;
int b;
private:
int a;
int b;
protected:
int GetA() const;
void SetA();
public:
int GetB() const;
AA & operator=(const AA & a);
public:
AA();
AA(const AA & a);
};
可以看到struct和class没有区别,唯一的区别是,如果没有写public、private等,struct缺省是公有成员,class缺省是私有的。