#include#include class MyClass : public Glib::Object { public: MyClass() {} ~MyClass() {} void do_something() { std::cout << "Doing something." << std::endl; } }; int main() { Glib::RefPtr obj1 = Glib::RefPtr ::create(); Glib::RefPtr obj2 = Glib::RefPtr ::create(); obj1->do_something(); obj2.add_pattern("MyClass_*"); return 0; }
#includeThis code creates an instance of the MyOtherClass GObject-derived class and registers a pattern that matches any object whose class name starts with "MyClass_". This example demonstrates that the add_pattern method can be used to register patterns for any class that derives from GObject. Package Library: cpp glib#include class MyOtherClass : public Glib::Object { public: MyOtherClass() {} ~MyOtherClass() {} void do_something_else() { std::cout << "Doing something else." << std::endl; } }; int main() { Glib::RefPtr obj1 = Glib::RefPtr ::create(); obj1.add_pattern("MyClass_*"); return 0; }