October 20th, 1999, 08:03 AM
Hi, all,
I'd like to create a base class "CBase" that will be a base for all my
classes.
CBase would have to obtain the "This" pointer of the parent object.
Suppose we have a class A containing an object (not a pointer to) "Dummy" of
class B.
Class B itself is derived from CBase.
I 'd like the "Dummy" object to automatically get a pointer to the class A
object, at the contruction time.
Viewing the assembly (Visual C++) of a constructor, I could see that ESP is
saved to FS:0 before the constructor call the constructor of any class
object or the constructor of any base class.
But, the problem is that I can't know the position of "This" from the ESP
register.
Anyone have an idea ?
Thanks a lot.
I'd like to create a base class "CBase" that will be a base for all my
classes.
CBase would have to obtain the "This" pointer of the parent object.
Suppose we have a class A containing an object (not a pointer to) "Dummy" of
class B.
Class B itself is derived from CBase.
I 'd like the "Dummy" object to automatically get a pointer to the class A
object, at the contruction time.
Viewing the assembly (Visual C++) of a constructor, I could see that ESP is
saved to FS:0 before the constructor call the constructor of any class
object or the constructor of any base class.
But, the problem is that I can't know the position of "This" from the ESP
register.
Anyone have an idea ?
Thanks a lot.