[omniORB] Client Object References

ryan.tecco rtecco@voxel.ummu.umich.edu
Fri, 5 Nov 1999 13:35:50 -0500 (EST)


Here's the problem,

IDL inheritance:
interface ThingOne
{ void hello(); }

interface ThingTwo : ThingOne
{ void helloTwo(); }

interface ThingThree : ThingTwo
{ void helloThree(); }

client wrapping:

class ThingOne {
protected:
	ThingOne_var to;
public:
	void hello()
	{ to->hello(); }
};

class ThingTwo : public ThingOne {
protected:
	ThingTwo_var tt;
public:
	void helloTwo()
	{ tt = ThingTwo::_narrow( to );
	  tt->helloTwo(); }
};

class ThingThree : public ThingTwo {
protected:
	ThingThree_var tth;
public: 
	ThingThree()
	{ to = // create a new ThingThree object, and return it's
               // reference as a ThingOne_var
	void helloThree()
	{ tth = ThingThree::_narrow( to );
	  tth->helloThree(); }
};

ThingThree thingThree; // constructor creates the object using ThingOne's
		       // pointer
thingThree.hello();    // works okay
thingThree.helloTwo(); // aborts
thingThree.helloThree(); // works okay ( when above line is omitted )

Any suggestions on basic things I am doing wrong would be great!

rt

--------------
ryan.tecco
734.476.6646
the university of michigan
"i'll never forget my life 
as a carrot."