Dear rooters, here is a simplified example to illustrate my question: If I have a class class A : public TObject { TNamed *fNamed; ~A() { if (TestBit(BIT(14)) delete fNamed; } void SetName(const char *name) { fNamed = new TNamed(name, ""); SetBit(BIT(14)); } vodi SetName(TNamed *name) { fNamed = name; ResetBit(BIT(14)); } ClassDef(A, 1) } and now I create an instance of this class A a, b; a.SetName(new TNamed); b.SetName("NewName"); and write both objects to a file: a.Write("Obj1"); b.Write("Obj2"); now I read this object into new objects: A c,d; c.Read("Obj1"); d.Read("Obj2"); As I understand it, now both objects (c and d) have a newly allocated TNamed. But for one of the two objects BIT(14) is set and for one not. How can I make sure, that the destruction of the TNamed-data-member is done correctly in any case? Thanks in advance, Thomas.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET