Tell me why u are writing this-> beore every data member of the class if will not write then is it correct or not ? and tell me which i use i have write these two code which i shuld use?


2nd code is below first code

Hello @kailash_01,

  1. You use this->data_member_name, to access the data members of the class.
    No, it is not mandatory to use this.
    But, it is useful when the parameters have the same name as that of the class data member.
    this-> will help to distinguish between the data member and the local parameter of the function.

  2. You can use any of the two if they are successfully imitating the operation of queue.

Hope, this would help.
Give a like if you are satisfied.

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.