Slimelite BBS

New

Back to EMULATE

From Cliff Rhodes · 1996-03-31 19:45 · #73507 in EMULATE

--> Tom Chantry wrote to All  <--

TC>   If you create a class or structure with new, ie
TC>      class * a= new class;
TC>   , is there any benefit in creating things in that class with 'new' or
TC>   will it not matter?

I guess you know your allocation code is bad. class can't be used like that:

class Aclass {
...
};

int main(void)
{
   Aclass * A = new Aclass;
...
}

There is not any special benefit in allocating objects inside a dynamically 
allocated class with new. In some cases it might be a good idea, in others 
not a good idea. You will have the usual tradeoffs of dynamic allocation. 
You are free to choose whichever method makes the most sense for your 
application.
___
 * CMPQwk 1.4 #1692 * "Audacity augments courage; hesitation fear." - Publilius S

--- Maximus/2 3.01
 * Origin: COMM Port OS/2 (713) 980-9671 (1:106/2000)