I have an abstract class AUnit with variables and getters/setters in virtual pure like this
class AUnit {int var... int getVar() const = 0 ... }
All the data is in protected: except constructor and destructor.
I have Berserk and Tank as child like this
class Berserk : public AUnit
{
...
private:
int getVar() const;
In their .cpp, I write the code of the getters and setters. Nothing special.
But I have one other class (foo for example) like this
class Foo : public Berserk, public Tank
who need to access the data in Berserk or Tank so I changed the private keyword by protected, here is the error :
Tank.hpp:36:25: erreur: ‘virtual int Tank::getY() const’ is protected
error inside the context
As first, I just tried to access the data with the AUnit getter but cause of virtual pure and abstract concepts, I thought to reinterpret_cast my AUnit in his real type after passing getType of AUnit in non-pure and in public. Still not working, its the scheme I told you earlier.
It's just classical heritage, can I have some help ?