On Sun, 15 Mar 1998, Nick van Eijndhoven wrote: > > TString* s; // In the private area of my class > > s = new TString("small_test"); // In one of the initialisation > // member functions > > char* ch=s->Data(); // In another member function. > > However, the last statement gives me an error message in ROOT > > "illegal pointer to class object". > > I also tried : char* ch=(char*)s->Data(); > char* ch=(const char*)s->Data(); > > but nothing worked. May be the following scenario will work: class MyClass { private: TString *s; ... public: char *GetData() { return( s->Data() ); { ... }; Use it as: MyClass mcls; char *ch = mcls.GetData(); Happy ROOTing Radovan
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET