How to initialize in constructor?
I have a class that I want to hold a value in like this -
Code:
class guiwindow {
public:
guiwindow();
~guiwindow();
Fl_Window& getWindow();
private:
Fl_Window window;
};
#endif
Then I want to initialize it in the constructor like this -
Code:
guiwindow::guiwindow() {
Fl_Window win( 300,200,"Testing");
win.begin();
Fl_Button but( 120, 90, 70, 30,"Click me" );
win.end();
but.callback(but_cb);
win.show();
Fl::run();
window = win; //HERE
}
Why won't this work? Is there a way to make it work without overloading the = operator or declaring it as a pointer in the header? Any help is appreciated.