2016年6月28日

C++ 类中的const关键字

摘要: //类中的const关键字 #include using namespace std; class Point{ public: //这个const关键字本质上修饰的是this指针 int GetX() const //====>int GetX(const this) { //因为this被隐藏,所以const关键字只好写在函数后面 /... 阅读全文

posted @ 2016-06-28 21:49 寒魔影 阅读(215) 评论(0) 推荐(0)

C++ 运算符重载四(自定义数组类)

摘要: //自定义数组类 #include using namespace std; //分析:能获取数组长度,添加元素,删除元素,修改元素 //要求重载[],=,==,!=运算符 class MyArray { private: int mLength; int* mSpace; public: MyArray(int length){ cout (mLe... 阅读全文

posted @ 2016-06-28 21:29 寒魔影 阅读(1007) 评论(0) 推荐(0)

导航