摘要: 使用对象的两种方式: ——栈中的对象: CStudent stu; stu.setAge(14); cout<<"Age is :" << stu.getAge(); ——堆中的对象:使用new/delete CStudent *pStu; pStu->setAge(14); cout<<"Age is :" << pStu->getAge(); delete pStu; pStu = nullptr; //若编译器不支持,则 pStu = NULL; 说明:delete之后最好重置为空,可防止 阅读全文
posted @ 2013-01-30 08:46 卧野观云 阅读(180) 评论(0) 推荐(0) 编辑