So maybe this is a stupid question, and I think about it, but I have the following situation. I am making a "Shell class" that can run abstract objects of the Action class. This is the only class that should create or use these objects. Action objects must have access to the shell to perform certain actions on it, but I try to avoid adding public interfaces for this (no one should allow this).
I initially had a simple (not very elegant)
class Shell { public: bool checkThing();
So, I looked at the nested Action class, but I wanted to make it private (why let someone else do specific actions except Shell, right?)
class Shell { public: bool checkThing();
But, of course, I can no longer inherit from Action (which makes sense, it's private). So this will not work.
So my question is, should I just go with the first method, friendship or public interface? Can I use something similar to the second method to preserve this relationship with actions and shell? Do you have an idea?
Matt
source share