[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Basic QT question
From:       Florian Roth <florian () synatic ! net>
Date:       2005-02-15 19:27:54
Message-ID: 200502152027.54326.florian () synatic ! net
[Download RAW message or body]

Am Dienstag, 15. Februar 2005 19:33 schrieb Esben Mose Hansen:
> On Tuesday 2005-02-15 15:50, mETz wrote:
> > You do have to in C++!
> > Only stuff created on the stack is gone after you exit your function.
> > Creating stuff on the heap (using malloc() or "new Something") forces you
> > to keep a pointer around so you can delete it later on. Remember, C++
> > doesn't have a garbage-collector so you have to take care of allocating
> > and freeing memory.
> >
> > The only exception in here is Qt. It has a parent-child system. Most
> > classes based on QObject take a parent argument. The parent then takes
> > care of deleting this object because the parent "knows" about its
> > children. If you delete the parent all children will be deleted too.
>
> If you don't care to keep tract of pointers yourself, you can use
> boost::shared_ptr, availble from boost.org or your favorite distribution. 
> I doesn't do cyclic dependencies, but such are rare anyhow.

I want to learn c++ and so I have to learn to work with pointers, don't you 
think? Nevertheless thanks for your tipps.

Greets
Florian
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic