CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to allocate the objects?
Your use of "new" is wrong. You can't use "new" directly in the class
definition. Instead, use "new" in the constructor of the class as in the
following:
class infoDB
{
public:
InfoDB();
protected:
AccountDB *wallet;
SavingDB* yucho;
}
InfoDB::InfoDB()
{
wallet=new AccountDB;
yucho=new SavingDB;
}
----------
> From: Takaaki Yagi <b101ttt@mxc.mesh.ne.jp>
> To: BCB Dev Journal <cpb-thread@zdtips.com>
> Subject: How to allocate the objects?
> Date: 28/جمادى الاولى/1419 04:49 ص
>
> 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