Use of "this" pointer

Is it really necessary to refer the data members of a class with this pointer when using them inside member functions ?

Because until this video (circular array implementation of queue) we were not using “this pointer” and it was working fine.

when u have same name of paramter and the data member of class ( in this case its necessary )
then u should be using this
but in other senarios as well this can be used it just refers to current object members.

But the parameter names are not same as the data member names in any of the functions defined in this video. :sweat_smile:

Ha so i told u
Its like a good practice to use this in case the names are same else its up to u
u may or may not use it

Got it … . Thanks for your help

1 Like