title: calling derived class method using base class object
body: <p>I have 6 classes as shown in figure below.
  Now, <code>class A</code> has an object of class <code>B</code> as a private variable defined. Also class <code>A</code> methods calls many methods from class B, for example <code>B.method1()</code>.
  Now, class <code>A_Base1</code> is which is derived from class <code>A</code>, needs to call methods from the derived class <code>B_Base1</code>; for example <code>B1.method2()</code>. And also methods of class <code>A_Base2</code> needs to call methods from class <code>B_Base2</code>; for example <code>B2.method3()</code>.</p>
  
  <p>Now in class A I define the variable as - </p>
  
  <p><code>private B bObject</code></p>
  
  <p>Now in method of <code>A_Base1</code>, I cannot cannot call the methods like <code>bObject.method2()</code> since its a base class object.</p>
  
  <p>I need suggestions on - </p>
  
  <p>Is it possible to call derived class object methods using base class object?
  Or do I need to re-design this scenario in some other good way?</p>
  
  <p><img src="https://i.stack.imgur.com/f6r53.jpg" alt="figure"></p>