C++远征之封装篇
1、类和对象
对象:具体的事物。类:对对象的抽象描述,一般有数据成员(属性)和成员函数(方法)
2、访问限定符
private,public,protected
3、访问类
栈的方式:class stack { int x; int y; void funx() { } void funy() { } }; stack sss; sss.x = 10; sss.funy();
堆的方式:class pile { int x; int y; void funx() { } void funy() { } }; pile *ppp = new pile(); ppp->x = 10; ppp->funy(); delete ppp; ppp = NULL;
=======================
原文:http://www.cnblogs.com/kekeximi/p/7051153.html