New course! Every coder should learn Generative AI!
Try a free lesson0
class lets you use constructors and destructors, which is advantageous when you have to initialise a variable. Also you can use "this" pointers in classes due to which you don't have to explicitly pass an object to a member function.