[C++-sig] abstract class and virtual function
Quant Mind
quant.mind at gmail.com
Sun Apr 15 23:09:51 CEST 2007
I'm running into some problem in exposing an abstract class with some
virtual functions with default implementations (no problem with pure
virtuals).
The problem seems quite trivial but I cannot get to the bottom of it.
struct rateWrap : public irate, public boost::python::wrapper<irate>
{
bool isScalar() const;
double value() const;
//
bool default_isScalar() { return this->irate::isScalar(); }
double default_value() { return this->irate::value(); }
};
//
inline bool rateWrap::isScalar() const
{
if(boost::python::override overfun = this->get_override("isScalar"))
#ifdef _MSC_VER
return boost::python::call<char const*>(overfun.ptr());
#else
return overfun();
#endif // _MSC_VER
return irate::isScalar();
}
//
inline double rateWrap::value() const
{
if(boost::python::override overfun = this->get_override("value"))
#ifdef _MSC_VER
return boost::python::call<char const*>(overfun.ptr());
#else
return overfun();
#endif // _MSC_VER
return irate::realvalue();
}
While the first function, returning bool, works fine :) the second one,
returning double, does not work!!! :(
I'm compiling with Microsoft Visual Studio 2005 which returns the following
error
'return' cannot convert from 'const char *' to 'double'
I don't know what is the problem, any advise?
Luca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070415/495d7094/attachment.htm>
More information about the Cplusplus-sig
mailing list