jyotirmoy bhattacharya wrote: > I want to use an abstract class derived from Gtk::Widget and then > derive different classes which use particular widgets to display > themselves. > > That is, I want to do something like > > class vwidget: public virtual Gtk::Widget > { > public: > virtual void magic()=0; > }; > > class mywidget: public vwidget, public Gtk::HBox > { > public: > void magic() {x=1;} > private: > int x; > }; > > mywidget m; > > But when I compile this I get the following errors: > document.h:86: error: no unique final overrider for `virtual void > Glib::ObjectBase::destroy_notify_()' in `mywidget' > document.h:86: error: no unique final overrider for `virtual void > Glib::ObjectBase::set_manage()' in `mywidget' > document.h:86: error: no unique final overrider for `virtual void > Glib::ObjectBase::destroy_notify_()' in `mywidget' > document.h:86: error: no unique final overrider for `virtual void > Glib::ObjectBase::set_manage()' in `mywidget' > The problem is that Gtk::HBox is also an Gtk::Widget and thus for example Gtk::Hbox has methods like Gtk::Widget like set_manage(), destroy_notify_(), ... . How can the compiler know if you want to use Gtk::Widget::set_manage() or Gtk::HBox::set_manage() in your mywidget class ? If you really want to do this, you have to make that decission yourself for every method the compiler complains about.
class mywidget: public vwidget, public Gtk::HBox { public: void magic() {x=1;} // this are unique final overriders void destroy_notify() { vwwidget::destroy_notify(); } void set_manage() { Gtk::HBox::set_manage(); } // .... private: int x; }; Maybe may also be interested in http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.11. Hope this helps, Antonio > I am using gtkmm 2.4 and g++ 3.4.2 > > Not making Gtk::Widget virtual in the definition of vwidget leads to > the same errors and > I don't think that would solve my problem anyway. > > I would be grateful if the subscribers of this list can suggest a way > out of my problem. > > --Jyotirmoy > _______________________________________________ > gtkmm-list mailing list > gtkmm-list@gnome.org <mailto:gtkmm-list@gnome.org> > http://mail.gnome.org/mailman/listinfo/gtkmm-list > > ------------------------------------------------------------------------ _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list