#include <iostream>
using namespace std;
class Sample
{
int a;
public:
Sample() : a(-1) {}
void GetValue() const;
void test(){
cout<<"test() was called!"<<endl;
cout<<"obj.a="<<a<<endl;
};
};
void Sample::GetValue() const
{
cout << "GetValue() const was called!" << endl;
cout<<"obj.a="<<a<<endl;
}
int main()
{
const Sample obj;
obj.GetValue();
return 0;
}
转载请注明原文地址:https://blackberry.8miu.com/read-27551.html