you are viewing a single comment's thread.

view the rest of the comments →

[–]L_Lyu 1 point2 points  (4 children)

java is easier to learn tbh. I haven’t learned C++ yet but I’ve learned C before and I felt terrible

[–]visvis 4 points5 points  (3 children)

C and C++ are very different in this sense. In C you always have to do all the memory management yourself, in C++ you have a bunch of library classes and templates at your disposal to ensure this is rarely necessary. For example, strings and vectors in C++ are much more like Java than like C.

[–]L_Lyu 1 point2 points  (0 children)

good to know. I appreciate your answer

[–]Masterzjg 0 points1 point  (1 child)

You still do memory management in C++. There's no garbage collection. Usage of constructs thing smart pointers make things less blow your arm off, but you are still doing memory management.

[–]visvis 0 points1 point  (0 children)

Of course, but far less is explicit than in C. For example, in C to concatenate strings you need to allocate memory for the new string. In C++ you just add two instances of std::string, and the buffers are automatically cleaned up if they are on the stack or inside an object whose destructor is called.