上一页 1 ··· 197 198 199 200 201 202 203 204 205 ··· 207 下一页

2011年7月18日

C++常成员函数 - const 关键字

摘要: C++常成员函数 - const 关键字一、常成员函数详解声明:<类型标志符>函数名(参数表)const;说明:(1)const是函数类型的一部分,在实现部分也要带该关键字。(2)const关键字可以用于对重载函数的区分。(3)常成员函数不能更新类的成员变量,也不能调用该类中没有用const修饰的成员函数,只能调用常成员函数。A、通过例子来理解const是函数类型的一部分,在实现部分也要带该关键字。class A{private: int w,h;public: int getValue() const; int getValue(); A(int x,int y) { w=x,h 阅读全文

posted @ 2011-07-18 20:02 原来... 阅读(18008) 评论(4) 推荐(8) 编辑

上一页 1 ··· 197 198 199 200 201 202 203 204 205 ··· 207 下一页

导航