On 8/17/2015 11:39 AM, Stefan Seefeld wrote:
For the case with default implementation, the tutorial gives this wrapper:

   struct BaseWrap : Base, bpl::wrapper<Base>
   {
     virtual std::string func() const
     {
       if (bpl::override f = this->get_override("func"))
         return f();
       else
         return Base::func();
     }
     std::string default_func() const { return this->Base::func();}
   };

and it seems to me much more natural to implement the "default" case
directly in the "else" branch above, rather than add it to the "def()" call.

I think this might be so that python can invoke the superclass (C++) implementation directly in its override, but I'm not 100% sure.

Alex

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to