It's impossible. You can declare a method constthat will make all the variables const. You can declare a member mutableso that it can be mutated even in const. However, you cannot declare a member by mutableonly some methods.
: ? A . , .
A B , , :
class MyClass {
private:
AContainer A;
BContainer B;
public:
void myFunction1(){ B.myFynction1(A.get()); }
void myFunction2(){ A.myFunction2(B.get()); }
class BContainer {
int B;
public:
int get(){ return B;}
myFunction1(int A);
}
class AContainer {
int A;
public:
int get(){ return A;}
myFunction2(int B);
}
}