title: Inheritance: use inherited methods from parent pointer
body: <p>I'm working with some production code, some of which I cannot safely modify (without breaking things). My issue is that it I would like to use a specific method, one of the parameters of which is a pointer to a class. However the class as the parameter does not do what I want it to. </p>
  
  <p>So I wrote a sub-class of that class and am attempting to call the above function, but it still uses the parent class' methods. </p>
  
  <p>I have a MWE below:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Parent 
  {
  public:
      Parent() {};
      void method() {std::cout&lt;&lt;"in Parent\n";}
  };
  
  class Child : public Parent
  {
  public:
      Child() {};
      void method() {std::cout&lt;&lt;"in Child\n";}
  };
  
  void secondMethod(Parent* Pptr)
  {
      Pptr-&gt;method();
  }
  
  int main()
  {
      Child c = Child();
      Parent* parentPtr = &amp;c;
  
      c.method();
      parentPtr-&gt;method();
  
      secondMethod(parentPtr);
      secondMethod(&amp;c);
  
      return 0;
  }
  </code></pre>
  
  <p>In the above example running this the output is of course:</p>
  
  <pre><code>in Child
  in Parent
  in Parent
  in Parent
  </code></pre>
  
  <p>I believe the issue is slicing? Basically I'm casting to the pointer of the parent class, so it is considered as a Parent.</p>
  
  <p>I have seen some ways around this by making methods virtual in the parent class but I don't have that option.</p>
  
  <p>Is there some way to make secondMethod actual use the child's method? Specifically without changing the Parent class OR the secondMethod.</p>