diff --git a/CPlusPlus/intro/main.cpp b/CPlusPlus/intro/main.cpp index 109770c..b17a6ef 100644 --- a/CPlusPlus/intro/main.cpp +++ b/CPlusPlus/intro/main.cpp @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include "functions.h" #include "ClassA.h" #include "ClassB.h" @@ -115,8 +117,8 @@ int main() //cout << n << endl; //classB.GetNumber(); - IPrintable* pPrintable = nullptr; - pPrintable = new ClassB(); + //IPrintable* pPrintable = nullptr; + //pPrintable = new ClassB(); //(*pPrintable).Print(); //pPrintable->Print(); // same line as above, but simpler ////ClassB* pClassB2 = (ClassB*)pPrintable; // C-Cast, CAUTION: DANGER!!! @@ -138,7 +140,39 @@ int main() //delete pPrintable; //pPrintable = nullptr; - safeDelete(pPrintable); + //safeDelete(pPrintable); + + //vector numbers = { 0, 1, 2, 30, 5, 456 }; + //cout << "numbers size/capacity: " << numbers.size() << " / " << numbers.capacity() << endl; + //numbers.push_back(999); + //cout << "numbers size/capacity: " << numbers.size() << " / " << numbers.capacity() << endl; + //numbers[3] = 67; + // + //list numbers2 = { 0, 1, 2, 30, 5, 456 }; + //list::iterator it = numbers2.begin(); + //for (; it != numbers2.end(); it++) + //{ + // //*it *= 2; + // cout << *it << " "; + //} + //cout << endl; + + //numbers2.insert(--it, 999); + + //for (it = numbers2.begin(); it != numbers2.end(); it++) + //{ + // //*it *= 2; + // cout << *it << " "; + //} + //cout << endl; + + const size_t count = 5; + int numbers[count]; // const size -> stack array + + size_t count2 = 10; + int* numbers2 = new int[count2]; // dynamic size -> heap array + delete[] numbers2; + numbers2 = nullptr; return 0; }