[C++-sig] Re: Making copy of function derived from C++ pure virtual function

Paul F. Kunz Paul_Kunz at slac.stanford.edu
Fri Dec 10 16:38:12 CET 2004


>>>>> On Thu, 09 Dec 2004 20:37:18 -0500, David Abrahams <dave at boost-consulting.com> said:


> Sorry, this should be:

>      class_<FunctionWrap, std::auto_ptr<FunctionWrap> >(
> "FunctionBase", init<FunctionBase const&>())

Ok, that compiles.   Obvious no that I see it.

But now at run time I get...

Traceback (most recent call last):
  File "fitting.py", line 62, in ?
    f = Linear ()
  File "fitting.py", line 21, in __init__
    FunctionBase.__init__(self)
Boost.Python.ArgumentError: Python argument types in
    FunctionBase.__init__(Linear)
did not match C++ signature:
    __init__(_object*, FunctionBase)
>>> 

from ...

from hippo import FunctionBase
class Linear ( FunctionBase ) :
    def __init__ ( self ) :
        FunctionBase.__init__(self)
        self.initialize ()
    
    def initialize ( self ) :
        self.setName ( 'linear' )
        self.setParmNames ( [ 'Intercept', 'Slope' ] )
        self.setParameters ( [ intercept, slope ] )

f = Linear ()

---






More information about the Cplusplus-sig mailing list