class Hoge
{
public:
Hoge():x(0), p(&x){}
virtual ~Hoge(){}
void Foo(const int&) const;
private:
int x;
int* p;
};
void Hoge::Foo(const int& value) const
{
//x = 1; //Compile Error!
*p = value; //OK
cout << x << endl; //Foo is const...variable x
}
int main()
{
Hoge hoge;
hoge.Foo(10);
}