正在加载图片...
第6章类与对象 6.1类与对象 6.1.3成员的访问控制(续) 若不指定类中的成员的访问权限,则默认为私有成员 类也可以由 struct关键字声明, strust与cass的区别是:如果 不指定访问权限,前者缺省的访问权限是公有的,而后者是私有 的。用 struc声明前面的矩形类: struct CRect void SetColor(char*c) void Setsize(int I, int w) void Move (int t,intl void Draw private char color[10: t left int top t length int width6.1 类与对象 6.1.3 成员的访问控制(续) 若不指定类中的成员的访问权限,则默认为私有成员。 类也可以由struct关键字声明,strust与class的区别是:如果 不指定访问权限,前者缺省的访问权限是公有的,而后者是私有 的。用struct声明前面的矩形类: struct CRect { void SetColor(char *c); void SetSize(int l, int w); void Move(int t,int l); void Draw(); private: char color[10]; int left; int top; int length; int width; }; 第6章 类与对象
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有