add smart pointers
add polymorphism add destructor & copy constructor add pointer-pointer
This commit is contained in:
@@ -24,3 +24,17 @@ bool changeIntegerPerReference(int& n)
|
||||
n *= 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool createInteger(int* pN)
|
||||
{
|
||||
pN = new int(0); // BAD BAD - creates a memory leak
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool createIntegerWithPointerPointer(int** ppN)
|
||||
{
|
||||
*ppN = new int(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user