#includeusing namespace std;class MyClass{ public: int x; static int n; const int y; MyClass(int val) : x(val), y(20) { }// int get()// {// return x;// } //int get() const {return x;} // const member function //const int& get() {return x;} // member function returning a const& //const int& get() const {return x;} // const member function returning a const& int get() { return x; } int gett() const { n++; return y; } int getY() { cout<<"非成员函数常量getY"<
posted on 2018-02-14 23:04 阅读( ...) 评论( ...)