CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to allocate the objects?



Your 'new' statements belong in the class constructor, not in the date member
declarations.

class myclass
{
public:
	myclass( ) ;
protected:
	AccountDB * wallet ;
}

myclass::myclass(  )
{
  wallet = new AccountDB ;
}

Jack Romanowicz

Takaaki Yagi wrote:
> 
> Hello all.
> Please look at this
> 
> class
> {
>        protected:
>         AccountDB* wallet = new AccountDB;
>         SavingDB* yucho = new SavingDB;
> };
> 
> The new statements in the class are not valid. Why?
> We always need to make permanent object in heap memory
> however, if this can't, how we make relations of the classes
> and allocate the objects?
> Thank you
> 
> Taka Yagi b101ttt@mxc.mesh.ne.jp
> Phone 001-81-0166-33-4729
> Website http://www2s.biglobe.ne.jp/~exp/index.htm



W Komornicki's Home Page | Main Index | Thread Index