How to solve the multiple ambiguous inheritance?

Hi rooters,

I want to built a class PNode, and it inherits from class Node and class RParticle, both inheriting from TObject. When I made the library, the following error accured:

$ make
Warning: multiple ambiguous inheritance TObject and PNode. Cint will not get cor
rect base object address
Warning: multiple ambiguous inheritance TObject and PNode. Cint will not get cor
rect base object address
/usr/bin/g++ -O -Wall -fPIC -pthread -I/home/luxg/root/root-4.04.02g/include -c
PTreeDict.cxx
PTreeDict.cxx: In function void *ROOT::new_PNode (void *)': PTreeDict.cxx:130: request for memberoperator new’ is ambiguous
/home/luxg/root/root-4.04.02g/include/TObject.h:157: candidates are: static void
*TObject::operator new
(unsigned int, void *)

What are the problems?

Cheers, Xian-Guo Lu

Hi.

One way to solve problem with multiple TObject base-subobjects is to use virtual inheritance. But, I’m afraid, this want help you (I’m not shure, that CINT can work crrectly with it - hope, I’m wrong).

But you description is too short, can you give minimal code sample, please?

For example, you have warnings (about CINT behavior) and error messages about operator new.

#include

class A
{
public:
void * operator new(std::size_t s);
};

class B : public A
{
};

class C : public A
{
};

class D : public B, public C
{
};

int main()
{
new D;
}

here I do not have any ambiguity, because A::operator new is a static member function.
But you showed some errors with operator new.