Hi all,
A quick question on using pointers as data members for a class.
I am writing my own classes and integrating them into the root framework.
I have a class as follows:
class MyClass : TObject
…
private:
TGraph* pointer;
…
I initialise this pointer to NULL in the constructor. The memory is only allocated if the user decides they want to call a particular method, otherwise I don’t need to allocate the memory.
When I try to write this object to a root file (before the memory is allocated and the pointer is therefore still null) I get warnings.
My question is, what is the appropriate approach for using pointers as data members within root to get well behaved classes. It’s not completely obvious to me from my intital glances through the documentation.
Thanks!
Chris