Message from C, C++ discussions

December 2019

— Cppreference is your best friend for C++.


Any body please tell me where to use

auto obj = new Class();


Class obj;

i know one is pointer and delete manually
and other is object instance itself

— Doesnt matter really

— Use pointer if your object has a big weight.
Create object if not.

— One of them creates the object on the stack, the other one one the heap.

— 🤔👍

— Hi, can someone help me with a problem with classes?

— Whats thats means

— Think of it like, if you use new, its sorta persistent, and will stay in memory until you free it. while if you just instanciate the object, it will get deleted once you leave the scope

Message permanent page

— Ok i got that,

whats if i didn't delete it and program end. will it still take memory or memory free after program end

Message permanent page

— It *should* not

— It depends on your OS though