我想要學習C++,但我找不到,如果有可能以這種方式擴展一個類:類擴展的GtkWindow
main.cc
#include "mWindow.h"
using namespace std;
int main(int argc, char* argv[]) {
gtk_init(&argc, &argv);
mWindow win = mWindow();
gtk_main();
return 0;
}
mWindow.cc
#include "mWindow.h"
mWindow::mWindow() {
gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (this, "my window");
gtk_widget_show_all (GTK_WIDGET(this));
}
mWindow.h
#ifndef MWINDOW_H_INCLUDED
#define MWINDOW_H_INCLUDED
#include <gtk/gtk.h>
using namespace std;
class mWindow : public GtkWindow {
public:
mWindow();
};
#endif