I have a class base with a private array (I cannot make it protected).
I have getters and setters set for objects in the array.
base has a subclass sub1 and sub1 has a subclass sub2.
Is there a way to make sub1 only able to access some of base‘s getter’s and setter’s and make sub2 able to access other getters and setters?
Something with virtual methods perhaps?
No. Not in any good fashion
If you want this, you should break your base class into better granularity by creating several polymorphic interfaces and instead pass those interfaces around via pointer or reference so that each class only sees the functions it needs to see.