I called the size() function in isEmpty , push() , pop() and top().
But I got the same answer as in the video.
Then what’s the difference between using this.size() and size() ?
I am aware of the fact that " this " is used to point the object.
This.size() vs size()
both are same.
but when u invoke a method by using an object and suppose u have another local stack in the method.
then stack.size() and this.size() will give different outputs.
this.size() will refer to object stack and stack.size() will refer to the local stack.
Here local stack is made in the class in which we made all the functions of stack? (like push() , pop() ,…etc.)
Pls can u elaborate ur qn?
Whenever u use name.Dot operatoer it will always access the local things
And this.Dot operator will access the object things
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.