XForms: Class inheritance: Jacques's class design

Matthew Flax (flatmax@cse.unsw.EDU.AU)
Tue, 2 Sep 1997 01:37:25 +1000 (EST)

To subscribers of the xforms list from Matthew Flax <flatmax@cse.unsw.EDU.AU> :

Hello,

I was fiddling with c++ class structures.
I made one mother form, with several sub forms.
Next, I made a classy inheritance heirachy.
Now as with the Tremblay's example class, I too instantiate the sub forms
using a callback.
The problem is however that when the 'Show' method is called from a child
class, the 'Form()' method returns a pointer to the form at the top of the
heirachy. For this reason the 'Show("")' method does not show any sub
forms.
The body of 'Show' looks like so :
return fl_show_form(Form(), .......);

Where 'Form()' simply returns a pointer to the actual form :
return fd_Parent'sForm->Parent'sForm

so if I do either of the following :
Show("SubForm1"); // OR
ChildClass::Show("SubForm1");

No sub form appears.

If on the other hand I do the following :
fl_show_form(ChildClass::Form(), .....);

Then the correct sub form appears. whoopie!

Can anybody think of a method of calling the correct 'Form()' virtual
function ?

I have tried :
ParentClass wow;
wow.Show("Parent's form");
wow.ChildClass::Show("Child's form");

But same prob.

Thanks
Matt

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/