Re: Work with classesin C++
- From: Max Vasin <max-appolo mail ru>
- To: gtkmm-list gnome org
- Subject: Re: Work with classesin C++
- Date: Mon, 27 Feb 2006 17:31:57 +0300
>>>>> "Carlos" == Carlos Garces <carlos garces gmail com> writes:
Carlos> Hi. I have a problem with classes in C++ I'm reading a
Carlos> tutorial (http://www.cplusplus.com/doc/tutorial/) but I can
Carlos> find the error
Carlos> First, sorry it's hard to a Spanish VB programmer to explain a
Carlos> C++ problem in English
Carlos> Hi have a MainWindow class
Carlos> class MainWindow : public Gtk::Window { public:
Carlos> MainWindow(BaseObjectType* cobj,
^^^^^^^^^^^^^^
WTF is this? And why you need it? (I think you need just
MainWindow(Glib::RefPtr<Gnome::Glade::Xml>& pGlade);
if I understanrd you correctly).
Carlos> Glib::RefPtr<Gnome::Glade::Xml>& pGlade);
Carlos> pGlade is loaded in mpGlade and I use it to work....
Carlos> Now I want create a OptionsPane class that contain all the
Carlos> code of one GTK::NoteBook panel
Carlos> I', trying with this..... class OptionsPane { public:
Carlos> OptionsPane(Glib::RefPtr<Gnome::Glade::Xml>& pGlade);
Carlos> .... //GTK::NoteBook with all panels
mpGlade-> get_widget("MainNoteBook", mpMainNoteBook);
Carlos> //Init Options panel OptionsPane* mpOptionsPane(mpGlade);
Carlos, here you need to construct an object of type OptionsPane from
Glib::RefPtr<Gnome::Glade::Xml>, so you need to write:
OptionsPane* mpOptionsPane = new OptionsPane(mpGlade);
and then delete it when it not needed anymore:
delete mpOptionsPane;
Carlos> But compiler fails cannot convert
Carlos> `Glib::RefPtr<Gnome::Glade::Xml>' to `OptionsPane*' in
Carlos> initialization.
Carlos> Maybe my approach to this problem is wrong (I'm a beginner) ¿I
Carlos> need a Gnome::Glade::Xml is this class (to use mpGlade)?
--
WBR,
Max Vasin.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]