|
[Sponsors] |
July 28, 2009, 18:50 |
autoPtr, derived classes and memory leak
|
#1 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Hi,
i am trying to understand generic programming concepts used in OpenFOAM, and have a basic question in C++. suppose I have a "employee" base class which has virtual functions, and two derived classes: Code:
employeeExportA:public employee Code:
employeeExportB:public employee Code:
auto_ptr<employee> myEmployee; if (inputString == "A") { myEmployee = auto_ptr<employeeExportA>(new employeeExportA(4,5)); if (inputString == "B") { myEmployee = auto_ptr<employeeExportB>(new employeeExportB(4,5));; } |
|
July 29, 2009, 06:29 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
|
|