[Qt-interest] Should I delete the pointer ?

sarvesh saran aquarian.thunder at gmail.com
Sat Jan 15 07:23:52 CET 2011


Hi,

You must not delete on an object that was not allocated with new. If the
object was allocated on the stack, your compiler has already generated a
call to its destructor at the end of its scope.

thanks,
Sarvesh Saran

On Sat, Jan 15, 2011 at 9:46 AM, Qzi <hotseason007 at gmail.com> wrote:

>  Hi ,all ,! I'm trouble in the issue :
>
>        Should I delete the towers[4] ??
>
> Code here :
> ---------------------
> class hanoi : public QWidget
>
> {
>
>     Q_OBJECT
>
> public:
>
>     /*explicit*/ hanoi(QWidget *parent = 0);
>
>      void TowersOfHanoi(int n,int x,int y,int z);
>
>  private:
>
>     QStack<int> towers[4];
>
> signals:
>
>  public slots:
>
>     void ShowStatus();
>
>  };
>
> ------------------
>
> --
> *Your biological and technological distinctiveness will be added to our
> own. Resistance is futile.*
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110115/d0900226/attachment.html 


More information about the Qt-interest-old mailing list