the problem could be that you virtually inherit Gtk::Widget in
GUI::Database but non virtually in GUI::MYSQL::Database
therefore inheriting Widget more than once, which causes ambiguity.
following:
namespace GUI {
namespace MYSQL {
class Database : public virtual Gtk::HBox, public GUI::Database {
replace with:
namespace GUI {
namespace MYSQL {
class Database : public virtual Gtk::HBox, public virtual GUI::Database {
GUI::Database inherits virtually Gtk::Widget, which is OK and should be
left so.
On Fri, Dec 18, 2015 at 12:48 PM, Quentin Huot-Marchand <
[email protected]> wrote:
> Hello,
> I am Quentin and I work on a project who should be modular. For that I
> designed a simple way to add more "database".
> Here a uml graphic of what I try to do:
> ____________
> | Gtk::Widget|
> |----------------|
> |____________|
> /\ /\
> /__\ /__\
> ___________________| |
> | |
> _________ | _______|___
> | Window| 1 | 0..* | Database |
> |----------- | --------------------------------- |---------------|
> |_________| | |___________|
> | /\
> | /__\
> ______|_____ |
> | Gtk::HBox | _________|__________
> |----------------| | MYSQL::Database |
> |____________| |-------------------------|
> /\ |___________________|
> /__\ |
> |_______________________|
>
> My goal is to easily add different Database UI
> I tried to use resources from
> http://www.cprogramming.com/tutorial/virtual_inheritance.html and from
> http://www.cprogramming.com/tutorial/virtual_inheritance.html
> So in C++ I've got this
>
> MYSQL::Database
>
> namespace GUI {
> namespace MYSQL {
>
> class Database : public virtual Gtk::HBox, public GUI::Database {
> public:
> Database(std::string name);
> virtual void save() ;
> virtual Gtk::Widget & getToolbar() ;
>
> virtual void destroy_notify_() { GUI::Database::destroy_notify_(); }
> virtual void set_manage() { Gtk::HBox::set_manage(); }
> private:
> Gtk::Toolbar mToolbar ;
> Gtk::Label mLabel ;
> };
>
> }
> }
>
> With
>
> MYSQL::Database::Database(std::string name) : Widget(), HBox(),
> GUI::Database(name),
> mToolbar(), mLabel("hello") {
> this->pack_start(mLabel) ;
> this->show_all_children();
> }
>
>
> Database:
>
> namespace GUI {
>
> class Database : public virtual Gtk::Widget {
> public:
> Database(std::string name);
> std::string getName() const { return mName ; }
> virtual void save() = 0 ;
> virtual Gtk::Widget & getToolbar() = 0;
> virtual void destroy_notify_() { }
>
> Database(Database const&) = delete;
> void operator=(Database const&) = delete;
> private:
> std::string mName ;
> };
>
> }
>
> with
>
> Database::Database(std::string name) : Widget(), mName(name) {
> }
>
>
> And I've this compilation error:
>
> In file included from
> /home/spartan-117/Documents/NSS/DBConceptor/GUI/src/main_window.cpp:5:0:
>
> /home/spartan-117/Documents/NSS/DBConceptor/GUI/include/mysql/database.h:12:7:
> warning: virtual base 'Gtk::Widget' inaccessible in
> 'NSS::DBConceptor::GUI::MYSQL::Database' due to ambiguity [-Wextra]
>
> class Database : public virtual Gtk::HBox, public GUI::Database {
>
> ^
>
> /home/spartan-117/Documents/NSS/DBConceptor/GUI/src/main_window.cpp: In
> member function 'void NSS::DBConceptor::GUI::MainWindow::newDatabase()':
>
> /home/spartan-117/Documents/NSS/DBConceptor/GUI/src/main_window.cpp:73:33:
> error: 'Gtk::Widget' is an ambiguous base of
> 'NSS::DBConceptor::GUI::MYSQL::Database'
>
> this->mMainBox.pack_start(*dab);
>
> If you could help me I'll be really happy.
>
> Regards, Quentin Huot-Marchand
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list