class A;
class B {
private:
int x = 3;
protected:
int y = 4;
public:
int k = 5;
};
I would like A to be able to access B's public and protected members, but not its private members.
I do not want A to derive from B.
-In my program, I have class A which manipulates class B. I have built a system using these two classes, and thus B should only be able to manipulate A's private variables through A's protected functions.
What is the most elegant way to do this? Is it good practice to lay expose the variables in such a way?