vtbl of the subobject to the complete object
From: Marlene Miller <marlenemiller_at_worldnet.att.net>
Date: 12 Nov 2004 06:55:43 -0500 I am confused about the offset to the complete object in the vtbl of the subobject . Re: The C++ Programming Language (Special Edition) 15.4.1 page 409-410. class My_slider : public Ival_slider {
// polymorphic base (Ival_slider has virtual functions)
void g(Ival_box* pb)
My_slider* pd1 = dynamic_cast<My_slider*>(pb); //ok
There are two boxes labeled My_slider and vtbl. My_slider has an attribute vptr. There is a dotted arrow from the My_slider box to the vtbl box and a dashed arrow from the vtbl box to the My_slider box. "The dashed arrow represents an offset that allows the start of the complete object to be found given only a pointer to a polymorphic sub-object."
Regards, Marlene
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Received on Fri Nov 12 2004 - 03:52:03 PST
|
Click to report inappropriate content