P
Peter Neal
Hi,
Consider the following (contrived!) class:
class myclass
{
public:
void display() const;
void double_X(); // x = x^2
void double_Y(); // y = y^2
private:
int X;
int Y;
};
I can protect X and Y from mutation in the display function by defining it
as const.
How would I protect Y from mutation whilst inside the double_X function and
likewise X whilst inside double_Y?
Any help gratefully received!
Pete.
Consider the following (contrived!) class:
class myclass
{
public:
void display() const;
void double_X(); // x = x^2
void double_Y(); // y = y^2
private:
int X;
int Y;
};
I can protect X and Y from mutation in the display function by defining it
as const.
How would I protect Y from mutation whilst inside the double_X function and
likewise X whilst inside double_Y?
Any help gratefully received!
Pete.