Hi, there are basically two ways, in the ctor like below: class Fields { private: TMatrixD Ex; public: Fields() : Ex(10,10) { } }; or use TMatrixD::ResizeTo() which uses internall Allocate(). Cheers, Fons. On Sat, 2002-08-10 at 17:13, Choi Ki-young wrote: > I want to use TMatrixD class in other class. > this is some code of my apps. > > ----------------------- > class Fields{ > > /* > * Fields > */ > > public: > > TMatrixD Ex; > TMatrixD Ey; > TMatrixD Hz; > TMatrixD Hzx; > TMatrixD Hzy; > > Fields(int x, int y); > > }; > > Fields::Fields(int x, int y) > { > Ex.Allocate(x,y+1,0,0); > Ey.Allocate(x+1,y,0,0); > Hz.Allocate(x,y,0,0); > Hzx.Allocate(x,y,0,0); > Hzy.Allocate(x,y,0,0); > } > ----------------------- > > But, Allocate function is a protected member. So my attempt was useless. > How can I allocate memory for TMatrixD? Ansi c++ didn't allow non-static > members, so I can't use it's constructor, TMatrixD Ex(10,10). > > > > -- > Sincerely, Ki-young > -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:04 MET