Re: interface programming



Maybe u should try auto_ptr<ICar> in order to avoid the memory leak.

"dummy#1" <dummy1@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B913E5F4-9C59-4AFD-BD91-C6DFC29C0E6C@xxxxxxxxxxxxxxxx
Hi All,

I have a question.

In C#, I have auto garbage collector so I can freely do:

ICar pGenericCar = carFactory.createCar( toyotaEnum );

Without worrying about memory leaks.

in C++, how can I do the same without memory leaks?

ICar pGenericCar = carFactory.createCar( toyotaEnum ); // who will delete
this heap object since C++ interfaces have no ctor or dtor?


Thanks.



.



Relevant Pages


Loading