noodles1
Programmer
- Oct 31, 2001
- 58
If I have a pointer to an instance of a class, can I easily obtain a pointer to the instance of the parent class of that class?
An an example, if I have a class X that has as its parent, class Y, in a method for class X, I can access the pointer to the instance of class X via the keyword "this". Am I able to access a pointer to the instance of class Y that is created when the instance of X is created. Or is no specific instance of class Y created, even though the class Y constructor is called as a result of the constructor of class X?
An an example, if I have a class X that has as its parent, class Y, in a method for class X, I can access the pointer to the instance of class X via the keyword "this". Am I able to access a pointer to the instance of class Y that is created when the instance of X is created. Or is no specific instance of class Y created, even though the class Y constructor is called as a result of the constructor of class X?