Re: [ROOT] How to write destructor?

From: Valeri Fine (fine@bnl.gov)
Date: Fri Feb 15 2002 - 16:56:25 MET


Hello

You must treat that warning message as your error to be fixed.

If you want your own method Clear you still have to provide an implmentation of
the "base" Clear.

I mean your header file must look as follows:

class TANA : public TObject {
  public:
   void Clear(Option_t *opt){ TObject::Clear(opt);} // This is to preserve TObject::Clear
   void Clear();  // This is a prototype for your own Clear.
};

 If what you want is overloading of  the very TObject::Clear then the signature 
 of your method and TObject::Clear must match.
 I.e. you need

class TANA : public TObject {
  public:
   void Clear(Option_t *opt=''): // This is prototype for your own overloading Clear
};


   Hope this helps, Valeri
-----
Dr.Valeri Fine
STAR/US Atlas                                    E-mail: fine@bnl.gov
Brookhaven National Lab                Phone: +1 631 344 7806
Upton, NY 11973-5000                       FAX:     +1 631 344 4206
USA



----- Original Message ----- 
From: "Elena Vataga" <vataga@fnal.gov>
To: "Rene Brun" <Rene.Brun@cern.ch>
Cc: <roottalk@pcroot.cern.ch>
Sent: Friday, February 15, 2002 5:47 AM
Subject: [ROOT] How to write destructor?


> 
> 
> Hello!
> 
> Sorry for very naive question.
> 
> I wrote class with my analysis variables which
> inherit from TObject class and contains
> several  TClonesArray* Electrons, Muons, Jets etc .
> 
> When trying to put in destructor
>   Electrons->Clear();
> I am getting warning message:
> 
>           function "TObject::Clear(Option_t *)" is hidden by "TANA::Clear"
>           -- virtual function override intended?
>     void           Clear();
> 
> 
> Shell I just leave destructor vote?
> Or shell I use
>   Electrons->Delete()
> in TANA::~TANA ?
> 
> Thank you in advance,
> Elena
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET