I have the following snippet of code:
class Base {
//...
};
class Subclass : public Base {
public:
void foo() {
Base& ref = (*this);
}
//...
};
Where I pass this reference to the constructor of some other objects for later use. According to the following article (and what I know about references), if I get the address of ref, it should be the same as this.
Is the address of a reference to a dereferenced pointer the same as the address of the pointer?
However, this is what I am seeing when I run the code:
this 0x20002288
&ref 0x20003314
The addresses are NOT the same. Does anyone know why this would be?
Thanks!