dear friends,
I wanted to write a small class which should act both as a container class and as a steering
class for data I/O.
the idea is the following:
class myclass : public TObject {
public:
void ReadData(Char_t *filename);
void WriteData(Char_t *filename);
private:
Int_t data;
};
I could implement the WriteData function
void myclass::WriteData(Char_t *filename) {
TFile *file.......
TTree *tree.......
tree->SetBranch("branchname", this);
}
whereas I don’t know if I can actually implement the ReadData function. Indeed, I should use the call
tree->SetBranchAddress("branchname", &this);
but like this the code doesn’t compile because of &this.
do you have any suggestion?
many many thanks.
best regards,
roberto