add smart pointers

add polymorphism
add destructor & copy constructor
add pointer-pointer
This commit is contained in:
2025-09-22 18:22:03 +02:00
parent d8f6014fab
commit 3b35b973c9
13 changed files with 208 additions and 7 deletions
+14
View File
@@ -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;
}