title: C++ protected heritage
body: <p>I have an abstract class AUnit with variables and getters/setters in virtual pure like this</p>
  
  <pre><code>class AUnit {int var... int getVar() const = 0 ... }
  </code></pre>
  
  <p>All the data is in protected: except constructor and destructor.</p>
  
  <p>I have Berserk and Tank as child like this</p>
  
  <pre><code>class Berserk : public AUnit
  {
  ...
  private:
  int getVar() const;
  </code></pre>
  
  <p>In their .cpp, I write the code of the getters and setters. Nothing special.</p>
  
  <p>But I have one other class (foo for example) like this</p>
  
  <pre><code>class Foo : public Berserk, public Tank
  </code></pre>
  
  <p>who need to access the data in Berserk or Tank so I changed the private keyword by protected, here is the error :</p>
  
  <pre><code>Tank.hpp:36:25: erreur: ‘virtual int Tank::getY() const’ is protected
  error inside the context
  </code></pre>
  
  <p>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.</p>
  
  <p>It's just classical heritage, can I have some help ?</p>