RE:Re: [ROOT] Problems accessing protected

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Thu Jun 01 2000 - 16:23:14 MEST


Hello Birger,

Let me confirm the situation.

You have a precompiled class with protected data member  and an
interpreted class which inherits from the precompiled class. 
Protected data member is assigned in a member function of inherited
class. If this is true, this is a ROOT/Cint limitation. You can not
access protected member of a precompiled class from an interpreted 
class.

This could be theoretically solved by generating stub sub-class for
every precompiled class. However, this will double the size of dictionary.
This is quite fundamental for a compiler independent C++ interprter.
Please consider following workaround.

Workaround:
  1. Compile the derived class also, at least, where you want to access
    the protected member and virtual function.
    (See example in demo/makecint/Stub2 in cint source package)
  2. Add an access function to the protected member.

Thank you
Masaharu Goto

P.S.

I happen to have some e-mail access during the trip. But the line
is slow. Please do not expect much for a while.


>
>Hi Rene,
>
>thanks for your help. The solution you proposed seems to work. Anyway, the
>problem remains that I was not able to write into the protected data
>members of a class I derived from. This is a bug in CINT in case that I
>did not do a stupid error and it seems I didnt!
>If you have another look at the following lines, you can see that clearly
>fX should have the value of fx in the second printout, which it does not
>have.
>-----------------------------------------------
>  fx=(Float_t *)new Float_t[fN];
>  fy=(Float_t *)new Float_t[fN];
>  cout << "1.  " << fx << " " << fX << endl;
>  fX=(Float_t *)fx; fY=(Float_t *)fy;
>  cout << "2.  " << fx << " " << fX << endl;
>-----------------------------------------------
>Printout:
>1.  0x209895b8 0xc8
>2.  0x209895b8 0x209898e8   ??????????????????
>-----------------------------------------------
>My idea of the class was a polyline which automatically expands when
>one adds a histo in a way that it is allways the convex hull of all the   
>histograms passed to it. The reason for implementing it in this way is,
>that there is no TGraph with asymetric errors which can be drawn as a
>filled area. At least this is what I found in 2.24/02 and in some
>statement on the rootlist quite some time ago.
>
>Again thanks for your quick help,
>  Birger
>
>/------------------------------------------------------------\
>| Birger Koblitz                    koblitz@mail.desy.de     |
>| Max-Planck-Institut fuer Physik                            |
>| (Werner Heisenberg-Institut)                               |
>| DESY-FH1K                         Tel. (40) 8998-3971      |
>| Notkestr. 85                                               |
>| D-22603  HAMBURG                                           |
>\------------------------------------------------------------/
>



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET