I have a number of C++ classes which follow a common interface Foo_Interface.h. These classes are not “trusted”. I want them to have access to two methods to communicate with the main system (via Foo_Interface.h). As they extend Foo_Interface.h, that’s easy, I simply haven’t declared the methods A and B as virtual. However, these methods A and B need to have access to a class variable of the Foo_Interface (in this case, the address of the endpoint), which the subclass shouldn’t be able to see.
What I am trying to say is that this variable should only be visible to the A and B method (the variable would be instantiated via the Constructor), as these subclasses are run via a separate method (Foo_main).
Is this possible?
PutandGetdoesn’t sound much like a functional interface. It sounds more like a design smell. But anyway, just make the variable that they access,private.That’s what it’s in the language for.
It makes things
private.