Event display Editor

Dear ROOTers,
I’m trying to write the class for displaying some things. This class inherits from TEveElement and TNamed. For each of such class I prepared also editor.
Now, lets assume that I have class A and and B, each have own “editor”: A-EditorA and B-Editor, when I click in this “event display browser” in A class then A-Editor is created, when I click on B then B-Editor is created. So far so good.
The problem is when A is base class for B, and A-Editor i base class for B-Editor.
I supposed that after clicking on B, B-Editor should be created, this means that A-Editor is called once by B-constructor.
However when I check the output it seems that order of calls is following:

  • A Editor (called by B-Editor constructor)
  • B Editor (called by click on B)
  • A Editor (why? because B inherits from A?)
    The problem is that I would like to avoid this “third call”. For now the only solution is breaking the inheritance (A->B or AEditor->BEditor) however I would like to avoid such operation.
    Any Idea how to fix this issue?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi @dwielane,
sorry for the late reply!

I am not 100% sure I understand the problem, but indeed, in C++, when you construct an instance of a derived class the constructors of all base classes are called too. Public inheritance in particular models an is a relationship, i.e. an object of type B is (also) an object of type A.

I hope this helps.
Enrico

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.