ASImage problem in TASImage child class


I want to create a child class of TASImage and when I try to overwrite the ExecuteEvent function I run into the following problems:

Any ideas on how to resolve this? A minimal example is attached. If you comment out the ExecuteEvent function the code compiles fine. In the example, the function is a simple copy of TASImage::ExecuteEvent without any new code.

Gregor (112 KB)

In your “MyGui.cxx” file:

  1. replace all “->fImage” occurrences with “->GetImage()”
  2. in the beginning, add appropriate include files which are required in order to define the “ASImage” structure, which originates in the “libAfterImage” (warning: ROOT usually builds and uses its own version of the “libAfterImage”, so you cannot use the one that comes with your operating system -> see how the “libASImage” is built)

Thanks! “->GetImage()” works, even though I’m still wondering why I shouldn’t be able to access a protected base class member from a child class…

Anyway, I have decided to make do with

void MyTASImage::ExecuteEvent(Int_t event, Int_t px, Int_t py){

   // Do my own stuff afterwards:
   // ...

instead of messing with all the includes and copying files manually from build tree to install directory, particularly since other people are using the code on other machines.


One of the error messages was:

…/MyGui.cxx:38:43: error: within this context
if (fScaledImage) image = fScaledImage->fImage;

So the complain is accessing fImage via the pointer fScaledImage.

MyTASImage can access its own base classes data member but not those
from a different object.
but an object can access its own protected member in both itself and a
different object of the same type.
(See paragraph 11.5 ; it would have worked if fScaledImage was a