[ROOT] multiple inheritance from TObject

From: Benoit Revenu (revenu@iap.fr)
Date: Mon Apr 28 2003 - 18:02:09 MEST


Dear Rooters,

I want a class to inherit from 2 others classes inheriting from TObject.
I don't need this class to be in a dictionnary so that I DON'T get the 
rootcint error message :
-------------------------
Warning: multiple ambiguous inheritance TObject and C. Cint will not get 
correct base object address

I would like to do something like :
--------------------------------------------
cat test.h:
--------------------------------------------
#include "TMinuit.h"
#include "TObject.h"

class A : public TMinuit
{
  public:
  A(){}
  ~A(){}
  int a;
  ClassDef(A,1)
};

class B : public TObject
{
  public:
  B(){}
  ~B(){}
  int b;
  ClassDef(B,1)
};

class C : public A, public B
{
  public:
  C(){}
  //~C(){}
  int c;
};

-------------------------------------------------
cat test.cc:
-------------------------------------------------
#include "test.h"

ClassImp(A)
ClassImp(B)
-------------------------------------------------

-------------------------------------------------
cat LinkDef.h:
-------------------------------------------------
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link off all typedef;

#pragma link C++ class A;
#pragma link C++ class B;

#endif


Everything is ok if the destructor of C is commented out. If I remove the 
destructor, I got :
../src/test.h: In method `C::~C ()':
../src/test.h:26: request for member `operator delete' is ambiguous
/opt/root/include/TObject.h:164: candidates are: static void 
TObject::operator delete (void *, void *)
/opt/root/include/TObject.h:162: candidates are: static void 
TObject::operator delete (void *)
/opt/root/include/TObject.h:164:                 static void 
TObject::operator delete (void *, void *)
/opt/root/include/TObject.h:162:                 static void 
TObject::operator delete (void *)

What can I do ? Is it even possible ?


-- 

                Benoît

-------------------------------------------------------------------------------
GReCO / IAP
http://www.iap.fr/users/revenu
(+33) (0) 1 44 32 80 18
-------------------------------------------------------------------------------



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