If you create a local variable within a function, there's only 2 ways that the variable can be altered from outside of that function:
1) If you pass the variable's address to another function
2) If you pass the variable by reference to another function
(It's possible that you could use a preprocessor macro that disguises the fact that it's passing the variable's address to another function).
What you describe could only be made possible if the constructor for the wxScrolledWindow class took as an argument the address of the variable you use to store the address of the wxScrolledWindow object, something like:
Code: Select all
class wxScrolledWindow {
protected:
wxScrolledWindow **where_my_address_is_stored;
public
wxScrolledWindow(wxScrolledWindow **p)
{
where_my_address_is_stored = p;
}
~wxScrolledWindow()
{
*where_my_address_is_stored = 0;
}
};
Then, from within your own code, you've have to create a wxScrolledWindow something like:
Code: Select all
wxScrolledWindow *p = new wxScrolledWindow(&p);
This would be a dangerous setup though, because you would have to be careful though that the "p" variable is still in scope when the wxScrolledWindow object is destroyed (which probably won't be the case if the "p" variable is a local variable within a function).