Most applications will have only one Window, or only one main window. These applications can use the Gtk::Application::run(Gtk::Window&) overload. It shows the window and returns when the window has been hidden. This might happen when the user closes the window, or when your code decides to hide() the window. You can prevent the user from closing the window (for instance, if there are unsaved changes) by overriding Gtk::Window::on_delete_event().
Most of our examples use this technique.