Hi
in root v 4.00 on Fermi RedHat I try to compile this: tst2.cc:
#include
class datum{
private:
int dat;
void show(){
std::cerr<<"?!?!?!\n\n";
}
public:
datum(){dat=3;}
};
void tst2(){
datum dt;
std::cerr<<dt.dat<<"\n";
dt.show();
}
In my root session:
root [0] .L tst2.cc++
Info in : creating shared library /cdf/data3a/fedorko/selection_04261030/./tst2_cc.so
root [1] tst2()
3
?!?!?!
Why can I access private variables and functions?
Is this fixed later?
thanks,
Wojtek
[quote=“fedorko”]Why can I access private variables and functions?[/quote]Because Cint doesn’t stop you from soing so.
[quote=“fedorko”]Is this fixed later?[/quote]It’s on the to-do list. For now you’ll have to compile your code (.L mycode.C+) if you want to ensure that private vars are not accessible.
Axel.
When we build dictionary (and technically this is what happens when you use ACLiC (mycode.C+)), to properly access the information, we ‘break’ the privacy (#define private public). We are moving away from this implementation and thus this should be fixed in a future release.