• Jason Rhinelander's avatar
    Added advanced doc section on virtual methods + inheritance · 0ca96e29
    Jason Rhinelander authored
    As discussed in #320.
    
    The adds a documentation block that mentions that the trampoline classes
    must provide overrides for both the classes' own virtual methods *and*
    any inherited virtual methods.  It also provides a templated solution to
    avoiding method duplication.
    
    The example includes a third method (only mentioned in the "see also"
    section of the documentation addition), using multiple inheritance.
    While this approach works, and avoids code generation in deep
    hierarchies, it is intrusive by requiring that the wrapped classes use
    virtual inheritance, which itself is more instrusive if any of the
    virtual base classes need anything other than default constructors.  As
    per the discussion in #320, it is kept as an example, but not suggested
    in the documentation.
    0ca96e29
example-virtual-functions.py 2.8 KB