Boost.Python: Calling virtual functions from C++
Question: I'm not looking for help on _exposing_ virtual functions to Python, I would
like to know how I can call the said virtual functions from the C++ side.
Consider this...

    
    
    // ====================
    // C++ code
    // --------------------
    
    struct Base
    {
        virtual void func() {
            cout << "Hello from C++!";
        }
    };
    
    BOOST_PYTHON_MODULE(name)
    {
        // Expose the class and its virtual function here
    }
    
    
    // ====================
    //   Python code
    // --------------------
    
    from name import Base
    
    class Deriv(Base):
        def func():
            print('Hello from Python!')
    

Any advice on how I might grab a `Base*` to the derived type such that when I
do `base->func()`, the Python function is called? The Boost docs only describe
how to expose the virtual functions to Python, not how to call their
redefinitions from C+.


Answer: I think you just call `extract<Base*>(obj)` where `obj` is `python::object`.

