title: C++ Taking the Base Class as an Input and Accessing Derived Class Member Functions
body: <p>Say I have defined 2 classes, a base class and a derived class. Then I write a function that takes the base class as an input.
  When I use that function I will only ever pass in derived class functions and want to be able to access a redefined version of a base class method.
  So lets say both the base and derived class have a method foo(). I create a derived class variable and pass it into a function that only accepts base class variables. Inside that function I want to access foo() as it is defined in the derived class, not as it is defined in the base class.
  I have tried protected but that doesn't work.</p>