Correct me if I'm wrong but...
Each time I declare an object without assigning it a value, I am instantiating it (so long as the valid constructors is called upon doing so--)
like...
Triangle tri1 (3, 4);
and this object exists on the stackk but only for the duration of its life (which I still don't understand).
But if I do something like this...
Triangle *triPtr = new Triangle (3, 4);
it exists in the heap as dynamically allocated memory. Of course you have to delete (make the memory unallocated, or free) after using it should the program continue to run so you don't cause memory leaks..
My questions are...
-Why use the stack of the space is so limited?
-What are the advantages to using the stack over the heap?
-Is it really so bad to use pointers vs "reference variables?"
-What's the program's efficiency using a stack object over a heap object?
-What exactly is the life of a stack object? I hear that the existence of the object is dependent on its life or its declaration, which still confuses me...