摘要:
#include<iostream>using namespace std;class AA{public:AA(int s){x = s;}void setx(int) const;void pp() const;private:int x;};void AA::setx(int s) const//常量函数不可以修改成员{//x = s;}void AA::pp() const{cout<<x<<endl;}int main(){const AA a(3);//const对象只能调用const成员函数,那样成员就不会被非法修改//a.setx(5);a. 阅读全文
posted @ 2011-10-21 09:01
又是一年夏天
阅读(165)
评论(0)
推荐(0)

浙公网安备 33010602011771号