Search code examples
c++pointersreferencewxwidgets

Storing the pointer to a class in a reference


I have the following code as :-

wxSpinCtrl* m_spinner;

where wxSpinCtrl is a class and m_spinner is a pointer,what i require is something like we have:

int b;
int* a;
a = &b;

is the above kind of code available for

wxSpinCtrl* m_spinner;

Thanks


Solution

  • Of course

    wxSpinCtrl b;
    wxSpinCtrl* a;
    a = &b;
    

    This will work only if wxSpinCtrl has a public default constructor