C++ Inheritance. Changing Object data Types
<p>I am having trouble with forcing data type changes has on my own objects. I have a base class say "A" and two classes derived from "A" called "B" and "C". I pass objects "B" and "C" to a function that checks which type of object it is ("B" or "C"). Here is some example code below and the question to my problem:</p>

<pre><code>enum ClassType {"B", "C"};

class A {
  protected:
     m_Type;

  public:
     ClassType Type() { return m_Type}
     ...
     ...
};

class B : public A {
   otherMemberFunctions();

}

 class C : public A {
   otherMemberFunctions();

}


void WhatType(vector&lt;A*&gt;* candidates){


  vector&lt;B*&gt; b_candidates(0);
  vector&lt;C*&gt; c_candidates(0);

  for(int i = 0; i &lt; candidates-&gt;size(); i++){

    if(candidates-&gt;at(i)-&gt;Type() == B ){

      B* b = (B*) candidates-&gt;at(i);
      b_candidates(b);
   }

  //Same idea for Object C
  }
}
</code></pre>

<p>I would then use WhatType(vector* candidates) as follows</p>

<pre><code>vector&lt;B*&gt;* b_example

WhatType((vector&lt;A*&gt;*) b_exmaple)
</code></pre>

<p>When I have filled the new vector b_candidates in the function WhatType. Will I still have access to the member functions in the B object or will I only have the access to the member functions in the base class A?</p>

<p>I am confused to what happens with the object when I change the type of the object.</p>

<p>Here</p>

<pre><code>WhatType((vector&lt;A*&gt;*) b_exmaple)
</code></pre>

<p>and here</p>

<pre><code>B* b = (B*) candidates-&gt;at(i);
</code></pre>
