[C++-sig] Pointer concept help

dueymk dueymk at everestkc.net
Tue Dec 13 23:46:35 CET 2005


I've been reading docs and googling for 2 days trying to find an answer.

With the following C++ definitions:

struct MyStruct1 {
	int sample1;
	int sample2;
}

struct MyStruct2 {
	int first;
	char second;
	MyStruct1 *child;
};

class MyClass
{
	MyStruct2 *CreateStruct()
	{
		MyStruct2 *returnValue = new MyStruct2;
		returnValue->child = new MyStruct1;
		return returnValue;
	};
}

I'd like to call 'CreateStruct' from Python and access the fields of the actual object that was created in 'CreateStruct', not a copy local to Python.  Can I do that and how?

Also, can I get access to the structure pointed to by the 'child' field?

Thanks,
Jim



More information about the Cplusplus-sig mailing list