Why did he leave one function of Car() Empty? also why did not he intitalise name as this->name = n?

Can Someone explain me how this Empty Car() function works?

Hey @JaveedYara
An empty constructor is used to create an object/instance of the class.Its a good practice to make one when you are creating your own constructors.

You can use this-> name=n as well.
So, when we need to use this->?
when the name of the data member and the parameter of the function has same name.
Thus, to uniquely identify the data member we use this->, as is done in the case of x and y.

Hey @JaveedYara
Do u have any other doubt in this ?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.