Object allocated dynamically and not in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Object allocated dynamically and not in C++

What is the difference between allocate objects dynamically with "new" keyword ad reference pointers and objects without "new" keyword in C++?

30th Dec 2018, 1:03 PM
RoboCybernetic
RoboCybernetic - avatar
2 Answers
0
Thank you for the answer Rewa, but seems that there is a convenience to create objects without "new" keyword because don't need to destroy it. So, why the need to use dynamically allocation in the heap?
30th Dec 2018, 2:13 PM
RoboCybernetic
RoboCybernetic - avatar
0
For example Java use dynamically allocation with new keyword and Garbage collector destroy automatically when need. This is very confusing for me
30th Dec 2018, 2:15 PM
RoboCybernetic
RoboCybernetic - avatar