Even though you believed the "return *this" example in your copy function to be contrived its exactly what I was looking for. I wasn't sure if the * was de-referencing the "this" or if I was looking at new syntax in a very convoluted book my school provided me. Thank you.
I have one doubt like we say "this pointer is const pointer" prototype is class_name* const this; and in your code sometimes it points to besty and sometimes it points to georgy ,basically you r changing the content of this pointer right?SO ,HOW IT CAN BE A CONST POINTER?
Here is a really stupid quetion my brain came up with: If 'this' is a pointer, then how can I access the value stored in that address by using 'this', like inside of method?
Excellent question. I made some videos to answer just that. I can't post links in a comment box here, but here are the two youtube video codes. Just watch these two videos: 1- tFjcDICYvE0 2- PItm2_TZ0wA
11 years old but still great! Thank you for uploaded, finally I have understand! (from 2023 )
An absolute masterpiece. I'm currently in Uni and "this" pointer was a strugle for me. Thanks a lot mate, wish you the best!
And...I finally figured out how to post the videos as responses to this video, so you will see the links to them on this page as well.
Thank you sir! You make it all so clear with your example, really help with the convoluted C++ book I'm learning from.
Wonderful tutorial. Thanks a lot, I had looking for an easy explanation of this for some time now. You explained wonderfully
Thanks for the kind comment!
awesome content Jamie King. I crushed the thumbs up on your video. Keep on up the exceptional work.
Thanks for the kind words. Hope the videos help.
Even though you believed the "return *this" example in your copy function to be contrived its exactly what I was looking for. I wasn't sure if the * was de-referencing the "this" or if I was looking at new syntax in a very convoluted book my school provided me. Thank you.
I still didn't understood it, can you please explain what's the use of "*this" ?
Great way to teach the concept of "this" :)
Thanks so much for this. After reading so much I could not understand it until watching this seven-minute video.
I'd like to know how returning an object's address value is useful.
Maybe analogy would be telling someone your telephone number so you can be reached easily.
0:40 Betsy are you pr... this pointer xD
Could you please post an video explaining the difference between this and *this.
Mithun V
this gives you the adress of instance of a class object, where *this will give you the value stored in that address
ok makes sense... can someone give an example of a practical use of this this isn't contrived?
I have one doubt like we say "this pointer is const pointer" prototype is
class_name* const this;
and in your code sometimes it points to besty and sometimes it points to georgy ,basically you r changing the content of this pointer right?SO ,HOW IT CAN BE A CONST POINTER?
Its unique in each instantiation. The betsy this is unique and the georgy this is unique.
Here is a really stupid quetion my brain came up with: If 'this' is a pointer, then how can I access the value stored in that address by using 'this', like inside of method?
this->someFieldDataMember
@@JamieKingCS Thanks! :)
Useful! Thank you
Thnaks a lot
Jesus...I am trying to explain it to myself by saying "bobby ..betsy...points to a cow..." and it sounds funny.
Thank you!
I'm not gay but I love you dude. Many thanks for the video.
So "this" is a pointer to the objects location on the stack.
what's the difference between " const void printThisPointer()" and " void printThisPointer() const"?
Excellent question. I made some videos to answer just that. I can't post links in a comment box here, but here are the two youtube video codes. Just watch these two videos:
1- tFjcDICYvE0
2- PItm2_TZ0wA
Thanks... it helped a lot~
What does the const after the function parentheses do?
just tells the compiler that that function only reads, not writes
can I pass this as an argument to an outside function?
- Let's talk about this.
- About what?
:P
ery nice..........
It helped me :)
How are you able define main as a void type? My compiler requires it to be an int.
It depends on the compiler. My compiler simply treats void as an int return type and automatically returns 0 for me.
I see. I guess g++ will only accept an int.
dude... u are full of swag xD lovely... there comes ur like... just the end got a little messy
ابو حسين يا وردة
i got it bro
Жарайсын))
देशराज पटेरिया
->->->-> :D
Sorry--this is not clear for a student programmer--