I'm new to c++ but I do have a programming background.
I understand that there are three ways of allocating memory: on the stack statically, on the stack dynamically and on the heap dynamically. I just don't understand which one will take place with the following statements and how to delete memory used by them:
Thanks in advance.Code:class MyClass1 { int intArray[10]; ... } class MyClass2 { int* intArray; ... } class MyClass3 { OtherClass anotherObject; ... } class MyClass4 { OtherClass* anotherObject; ... public: void TestMethod(); } void MyClass4::TestMethod() { OtherClass* localObject = new OtherClass; }
Cheers.


Reply With Quote