button creation in C++ GUI

#include <iostream>
#include <gtkmm.h>

class MyWindow : public Gtk::Window {
public:
    MyWindow() {
        // Set window title
        set_title("Button Example");

        // Set window size
        set_default_size(200, 100);

        // Create a button with label
        button.set_label("Click me!");

        // Connect the button's clicked signal to a member function
        button.signal_clicked().connect(sigc::mem_fun(*this, &MyWindow::on_button_clicked));

        // Add the button to the window
        add(button);

        // Show all elements in the window
        show_all_children();
    }

    // Member function to handle button click
    void on_button_clicked() {
        std::cout << "Button clicked!" << std::endl;
    }

private:
    Gtk::Button button;
};

int main(int argc, char *argv[]) {
    // Initialize GTKmm
    auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");

    // Create the window object
    MyWindow window;

    // Run the application
    return app->run(window);
}