Posts

Showing posts from February 17, 2022

Static keyword

Destructors

 The first thing you do is dynamically allocate memory for the class. Create a pointer—that pointer exists on the stack. By using the new keyword, we dynamically allocate memory, return the pointer address to the variable on the stack. This way, we can access the memory on the heap. Constructor Dynamically allocates memory for variables. (On the heap.) After class is used, it can be deleted. Without destructor, dynamically created variables remain on the heap.

Heap and Stack

Heap and stack Dynamically created objects are placed in the heap.