title: Access child members within parent class, C++
body: <p>I am facing a situation where I need to access child member variables inside the parent class. I know this is against OO principles but I have to deal with a scenario where hundreds of classes are inheriting from one and along the way half of them stopped using one of the parents variable, and declared and used their own (there was need to switch from int to int[] and apparently the person who did that didn't take in consideration to apply this changes in the parent class instead). <br/><br/>
  One option is to have a virtual function to deal with it, but this means I have to change the code in hundreds of file/objects and test each one of them. Hence I thought if it is possible to use some old school C pointer magic to gain access to this variables inside the parent method, this will eliminate the need of hundreds of virtual functions.
  <br/><br/>
  Basically this is what I want to achieve:<br/><br/></p>
  
  <pre><code>class Parent
  {
      void DoSomething()
      {
          // This is what I need
          childMember = 0;
      }
  }
  
  class Child1 : Parent
  {
      int childMember;
  }
  
  class Child2 : Parent
  {
      int childMember;
  }
  </code></pre>
  
  <p>Please let me know if this is even possible. If yes how do I achieve that.<br/>
  Other suggestions are welcomed, but keep in mind that I'd like to make changes only in the parent class.
  <br/>TIA.</p>