Jump to content
  • Advertisement
Sign in to follow this  
CoMaNdore

*refrased* Derived from exposed class in boost python

This topic is 4127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey Refased this post since I kinda dint get any reply's. Hopefully it will be easier to see what I ask about this time :)
// the source code:
class A
{
	public:
		A()
		{
			std::cout << "A()" << std::endl;
			m_Value = 0;
		}

		virtual ~A() { std::cout << "~A()" << std::endl; }

		virtual void foo() = 0;
		virtual int ghey() { return( m_Value ); }
		int m_Value;
};


class B : public A, public wrapper<A>
{
	public:
		B() { std::cout << "B()" << endl; m_Value = 133; }
		virtual ~B() { std::cout << "~B()" << endl; }

		virtual void foo()
		{
			this->get_override( "foo" )();
		}
};

class C : public B, public wrapper
{
	public:
		C() { std::cout << "C()" << endl; }
		virtual ~C() { std::cout << "~C()" << endl; }

		virtual int ghey() { return( m_Value*2 ); }
		int m_Value2;
};
And here is how it is exposed for boost python:
BOOST_PYTHON_MODULE( bpydebug )
{
	class_<B, boost::noncopyable>("B")
		.def( "foo", pure_virtual( &B::foo ) )
		.def_readwrite( "Value", &A::m_Value )
	;

	class_<C, noncopyable, bases >( "C" )
		.def_readwrite( "Value2", &C::m_Value2 )
	;
};
This code works if you uncomment everything in the 'class_' declaration (remove the .def_readwrite part of C). Any idea how to fix this? [Edited by - CoMaNdore on June 8, 2007 10:00:22 AM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!