RE: [ROOT] Deriving a class after using Makeclass

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Jul 15 2003 - 19:26:39 MEST


Hi,

In C++, the members of a class are by default 'private' (i.e. accesible only
in the class' own context).
Just do:
   class Aphotclass : public photclass {
   public:
     Aphotclass(TTree *tree=0) : photclass(tree)  {};
   ....

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Claus Horn
Sent: Tuesday, July 15, 2003 11:51 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Deriving a class after using Makeclass


Hello ROOTers,

I am trying to derive a class (Aphotclass) from the class
which is generated automatically by MakeClass (photclass).
My declaration looks like this:

class Aphotclass : public photclass {
   Aphotclass(TTree *tree=0) : photclass(tree)  {};
   ~Aphotclass() {};
   //Int_t  Cut(Int_t entry);    // I dont want to change these
   //Int_t  GetEntry(Int_t entry);
   //Int_t  LoadTree(Int_t entry);
   //void   Init(TTree *tree);
   void   Loop();               // This is what I want to overwrite
   //Bool_t Notify();
   //void   Show(Int_t entry = -1);
};

Under ROOT I get:

root [1] .L Aphotclass.C
root [2] Aphotclass m;
Error: can not call private or protected function FILE:(tmpfile) LINE:1
  Aphotclass.h  18 Aphotclass Aphotclass::Aphotclass(TTree*);
Calling : Aphotclass::Aphotclass();
Match rank: file     line  signature
*        0 Aphotclass.h  18 Aphotclass Aphotclass::Aphotclass(TTree*);
*** Interpreter error recovered ***
root [3]

There seems to be a problem with the constructor.

I would be very glad if somebody could help me to get
this runnig.

Thanks,

Claus



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET