I have a share-pointer defined as
typedef std::share_ptr<MyClass> MyClassPtr;

and a class
Code:
class Example
{
public:
   MyClassPtr DoSomething()
  {
     return new MyClass();
   }
        
};
Now that I would like to implement a polymophic behavior as
Code:
class BabyExample:public Example
{
public:
    MyClassPtr DoSomething()
    {
        return new MyClass_Baby();
    }
};
This is what I have shortened up, the project code is a lot and messy. For this simplified (not simple) case, it sure works but in my application, DoSomething in the child class is never called, but the base class' instead. However, if I could change MyClassPtr into void*, it would work for sure!
I have tested this in those behaviors without share_ptr.

My questions are,
1. what actually happened that prevents the debugger from reaching the child method.
2. how can I change share-ptr to void*/void/void& ?

Thank you,