by PaulDavisThe1st · 1y ago · 0 comments
class Foo {
public:
void method_A();
protected:
friend class Bar;
void method_B();
protected:
friend class Baz;
void method_C();
private:
void method_D();
};
anyone can call method_A(), only Bar can call method_B(), only Baz can call method_C() and nobody can call method_D().You can do this by inheriting from 2 different pure abstract classes, but that feels much kludgier to me.