Dear Rooters
I’m developing a set of classes that inherits from TTask.
I was writing the assignment operator for these classes and of course I have to call the assignment operator of the base class and I noticed this note about the assignment operator of TTask:
root.cern.ch/root/html/TTask.html
I gave a quick look at the source code for the assignment operator and the only thing I noticed are these calls:
[quote] fOption=tt.fOption;
fBreakin=tt.fBreakin;
fBreakout=tt.fBreakout;
fHasExecuted=tt.fHasExecuted;
fActive=tt.fActive;
[/quote]
All these object are protected and shouldn’t be accessible. How is it even possible for ROOT to compile with such a call sequence. I derived many classes from TTask because I like to reuse the execution flow that TTask defines and I never had any complaint by the compiler and I didn’t had any problem during execution, even if I doubt I ever used the assignment of a TTask to another TTask.
If the assignment operator is wrong, as it’s said in the documentation shouldn’t it be better set private so that you don’t incur in the risk of using the operator without noticing this footnote?
Even worse is that the copy constructor, which is defined more or less by the same function calls is not marked in any way as wrong and this confuses me quite a bit.
Is there some reason due to the logic of the TTask class why it should not be assigned, but could be copy constructed? Is there some reason to keep a “wrong” method to be inadvertently called by the user?