Re: delete trouble

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Jul 05 1997 - 21:43:05 MEST


Voropaev S.G. wrote:
> 
> Dear ROOT people,
> I have written the following code in file bad.cpp:
> ---------------------------------------------------------
> class der :     public TObject
> {
> public:
>         der()
>         {       printf("der constructor\n");}
> 
>         ~der()
>         {       printf("der destructor\n");     };
> };
> void bad()
> {
>         der *p = new der;
>         delete p;
> }
> ----------------------------------------------------------------
> after start macro:
>         root [0] .x bad.cpp
> I have this output:
>         der constructor
>         der destructor
> and crash of ROOT program.
> 
> If I change string "class der : public TObject"  to "class der", all work fine.
> 
> I use root  1.00/10 in Windows NT 4.0. It is legal to use class derived from
> TObject
> in  interactive session? In documentation "Adding Your Own Classes to ROOT" I
> find:
> 
> "If you are only interested in interactive access to your classes via the
> command line or macro processor you do not need to use the ClassDef and
> ClassImp macros."
> 

Classes created interactively cannot inherit from TObject or a compiled
class in general. It would be very nice to have this possibility obviously.
It turns out that this is highly system dependent because CINT has to know
the VTBL specific to each compiler.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET