Re: Two warnings when creating a TreeStore



On Fri, 2007-09-14 at 12:07 -0400, Jos�lburquerque wrote:
> Murray Cumming wrote:
> > On Thu, 2007-09-13 at 11:15 -0400, Jos�lburquerque wrote: 
> >   
> >> As far as gtkmm and inheritance, I found that if I use something like 
> >> TreeModelColumn<MyBaseClass> in a TreeModelColumnRecord, derived members 
> >> of MyBaseClass only use the virtual methods of the base class (not the 
> >> derived class!), but if I use something like 
> >> TreeModelColumn<MyBaseClass*>, dereferencing the pointer to the derived 
> >> class later, does use the virtual (overridden) method of the derived 
> >> class.  Thanks again everyone for your help.
> >>     
> >
> > This is just like putting a Derived instance in a std::list<Base>. The
> > Base part will be copied into a new instance in the list, but that
> > instance won't be a Derived. This is how copy-by-value works.
> >
> >   
> I see, this is just standard C++.  I'm slightly new to C++ (coming from 
> C and then Java), but I *am* learning as I go along. :-)

Java doesn't really have copy-by-value for non-fundamental types.
Everything is a reference there. The rough equivalent in C++ is to use
smartpointers or regular pointers (plus your own memory management).

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]