If any one couldnt understand, follow this. Give a thought. I was too stuckee here and had to watch the same video couple of times. If I am wrong,correct me. This pointer : (this->) Like we saw in the previous video, that with the help of pointers we can point an object and use it. So here instead of creating a pointer explicitly. We can implicitly do with the help of inbuilt pointer known as this pointer. Syntax : as in previous video we used to use (*ptr).setData(variables); Which modified into ptr->setData(variables); (-> also known as arrow operator which derefernces and sends the value of the pointer to the class for the object we created). So here we use `this instead of ptr (both this and ptr are pointers. `this is inbuilt, while the ptr is the name we have given to a pointer which we made). Use of this pointer : 1) When the name of local variable (variables defined in the assignment of the function) and the instance variable or the variables which we created inside the class. Inshort local variable and instance variable when have the same name, then there is use of this pointer. • Why the need of to use? 1) Because the compiler will give more priority to local parameters than the global parameters. 2) It couldnt distinguish and, the value will be couldn't assigned to the variable of the object we defined. And due to non assignment of the variable of the object. The compiler will give our variable of the object, a garbage/random value. • How we use? - We use in this way Class Practice{ int a; public: void setData(int a){ Wrong : a = a; [The first a we used for is the object, and the second we use for is the local variable. This is thing which we know, but how will compiler know? So it will get confused. And take both the a as the local variables). Right : this->a=a; [With the help of this inbuilt pointer, the compiler gets to know that, woah this person defined the first a as the variable of the object (which object, the object which we currently defining and using) and the second variable as the local variable. Now we have successfully set the value of the variable of the current object and now it won't have a garbage value]. So i hope the first use of this pointer is clear, that here our this pointer, helped us in telling our compiler that this a is for our object and not for the function as a local parameter. } }; 2) When we need to chain the member functions of the class for the same object Also known as - to return reference to the calling object. • Why we use? - So that we can chain functions. And send the reference. • How we use or implementation? - class Practice{ int a; public: Practice & setData(int a){ this->a=a; //Value of a is set of the member function //Now to chain the function or send the reference return *this; //Here the returning helps to send us the same object for further to be used by the chains of function. } Syntax // Class_Name & Function_name (local variables) { code; } };
I want to tell you that many programming students from Pakistan love your videos as they are really helpful. Even our professors tell us to learn programming from your channel. I really find your videos amazing. Thanks once again 😊
i watched this video more than 10 times ,i thought i should skip it, but once i got the logic and reason behind i just amazed how easy it was , love the way you teach. keep doing great.
C++ is popular for developing different games or in gaming engines.... So can, you make a video on this thing in upcoming tutorial....it will give us a broad concept and idea to us...
Thanks for providing this amazing coding tutorials for free in hindi , thanks Harry bhai from bottom of my heart , carry on this good job, god bless you.....🙏🙏🙏😊😊
Bhaiya ish course ko advance tak le kr jaana or please data structures and algorithms bhi complete kra dena c++ se... Or Advanced level k projects bhihi btadena c++ k for job opportunities in big tech giants k liye.. And thank you so much bhaiya for all these courses...❤️❤️
sir plz upload videos on polymorphism and operator overloading. also.my papers are going to held in august.your lectures are really helpful for me and i really want to complete your series.thanks .
harry bhi 8:00 agar hum & ko nahi lagaye to bhi run kar raha he to kya difference he & lagane se or nahi lagane se ---> agar kese or ko pata ho to pls reply me
@@sudarshanmhaisdhune1039 Mujhe achha laga ki apko meri comment dekh ke khusi hui. But aapko mujhe pagal nahi samajhna chahiye tha, chalo samajh hi gaye toh koi baat nahi.
I have tried to write a code in c++ wherein I have initiated a class called complex: handling the functionalities of the complex numbers. Also, in the setData(), I have taken the input from the user with the same name as that of the class member by making use of the this keywords that prevents the display of any garbage value on the screen as per the following lines of code. Besides, I have attached my code below for any reference and feedback: CODE: #include using namespace std; // class complex : handling functionalities of the complex numbers class complex { protected: int real, imag; public: void setData(int real, int imag) { // using the this keyword to prevent display of garbage values this->real = real; this->imag = imag; } void printData(void) { cout
@CodeWithHarry A setData(int a){} A& setData(int a){} Are these 2 same because I am getting the same output when I am using both. Which is more appropiate? According to what I have understood since we are returning a object first one would be more correct.
2:21 हैरी को चीजों को कॉम्प्लिकेटेड करने का शौक है।a रखना ही क्यू है ।दोनो हमसक्ल लेकर जाओगे तो लोग कंफ्यूज होंगे ही ,इसमें तो कई पिक्चर बनी हुई है तीन घंटे की।a = a करना ही क्यू? क्लास भी A ,int bhi a और फंक्शन argument भी a।
Hi harry hope ur doing well First of all i would like to say ur are an awesome instructor I have been following ur web development course and ur phenomenal. I had a request harry pls upload a complete course on C# not a one video course Complete step by step from beginner to advanve level like ur web developemnt. I am eagerly waiting for ur response Thankyou Ajaz
Actually it's in this case "*this" is returning the the class A as an object and it when you write .getData it's point the getData function of the class which referring by this
3:16 Apke sath reh reh kar apka theme bhi apki tarah intelligent ho gaya he. Ye error ko point kar raha hai. Notice that both the a have same theme, but when Sir applies the "this->" keyword it changes it's theme.
I watched all your vides till now and it's really helpful ❤️❤️ thank you so much. But I have a request ..can u plz upload a series of data structures and algorithms including some competitive programming stuffs..? It will be a great help . Although u have dsa series too ....I aware of that And that is really good in developing basic concepts ❤️ But it will be more helpful I f u plzz upload some CP stuffs..😀 Ps: Its just a request ... Bcz I watched many youtube videos but it's only your channel where I am getting proper explaination so that's why I request you to start a CP and DS Algo series too..❤️❤️
Harry : The Code Machine
Ya, you are write bro
@@alinaaeell ya, you are listen bro
@@purushottamdafure1661 you are understand bro
@@yashkhivsara2827 ya. you are deleted bro
@@garenaunofficial7799 ya , you understand bro 🥲
If any one couldnt understand, follow this. Give a thought. I was too stuckee here and had to watch the same video couple of times.
If I am wrong,correct me.
This pointer : (this->)
Like we saw in the previous video, that with the help of pointers we can point an object and use it.
So here instead of creating a pointer explicitly. We can implicitly do with the help of inbuilt pointer known as this pointer.
Syntax : as in previous video we used to use
(*ptr).setData(variables);
Which modified into
ptr->setData(variables);
(-> also known as arrow operator which derefernces and sends the value of the pointer to the class for the object we created).
So here we use `this instead of ptr (both this and ptr are pointers. `this is inbuilt, while the ptr is the name we have given to a pointer which we made).
Use of this pointer :
1) When the name of local variable (variables defined in the assignment of the function) and the instance variable or
the variables which we created inside the class.
Inshort local variable and instance variable when have the same name, then there is use of this pointer.
• Why the need of to use?
1) Because the compiler will give more priority to local parameters than the global parameters.
2) It couldnt distinguish and, the value will be couldn't assigned to the variable of the object we defined. And due to non assignment of the variable of the object. The compiler will give our variable of the object, a garbage/random value.
• How we use?
- We use in this way
Class Practice{
int a;
public:
void setData(int a){
Wrong :
a = a;
[The first a we used for is the object, and the second we use for is the local variable. This is thing which we know, but how will compiler know? So it will get confused. And take both the a as the local variables).
Right :
this->a=a;
[With the help of this inbuilt pointer, the compiler gets to know that, woah this person defined the first a as the variable of the object (which object, the object which we currently defining and using) and the second variable as the local variable. Now we have successfully set the value of the variable of the current object and now it won't have a garbage value].
So i hope the first use of this pointer is clear, that here our this pointer, helped us in telling our compiler that this a is for our object and not for the function as a local parameter.
}
};
2) When we need to chain the member functions of the class for the same object
Also known as - to return reference to the calling object.
• Why we use?
- So that we can chain functions. And send the reference.
• How we use or implementation?
-
class Practice{
int a;
public:
Practice & setData(int a){
this->a=a;
//Value of a is set of the member function
//Now to chain the function or send the reference
return *this;
//Here the returning helps to send us the same object for further to be used by the chains of function.
}
Syntax //
Class_Name & Function_name (local variables) {
code;
}
};
👍👍
Thank you so much for the explanation. It helped me a lot. But still I am confused in the returning the reference part.
When we return a reference of the object we can also change the value of data member by member access operator.
you don't know how much time you saved,bro thank you
*thank you so much brother for the wonderful explanation , you deserve a 💝
I want to tell you that many programming students from Pakistan love your videos as they are really helpful. Even our professors tell us to learn programming from your channel. I really find your videos amazing. Thanks once again 😊
really bro nice to listen it
The best programming channel
i watched this video more than 10 times ,i thought i should skip it,
but once i got the logic and reason behind i just amazed how easy it was , love the way you teach.
keep doing great.
I also find hard in 1st attempt but after 2nd watch , i found it,s so easy and brilliant logic.
can anyone help me with the referce variable thing like &A ,what was that didnt understand this
@@prateeklikhar1893 same here
@@prateeklikhar1893 lecture 7 dekho reference variables ke liye
@@JustListen41473 harrry bhaiya ekdum clear explain nhi krpaye
Mujhe full clarity babbar bhaiya ki refernce variable video se hui
Highly suggested.
C++ is popular for developing different games or in gaming engines.... So can, you make a video on this thing in upcoming tutorial....it will give us a broad concept and idea to us...
How can we learn graphical programming in c++
Find a tutorial so you can learn "sfml" header file. It will help you to create 2d games
Keep it up Herry Bhai....👍👍
..
..
..
Best channel for programming
Thanks for providing this amazing coding tutorials for free in hindi , thanks Harry bhai from bottom of my heart , carry on this good job, god bless you.....🙏🙏🙏😊😊
You teach better and easy to understand than my college teachers such a good teacher have never seen before
Sir ji ek 💓 Dil to banta hai
Thank you so much harry bhai
Polymorphism aur file handling bacha hai fir meri c++ complete
Best channel in you tube for programming. Excellent teacher.
Your the best teacher in the world...
Bro..
You don't know that you are doing such a 💓GREAT WORK💓 for us.
plz reply return obj what does it mean by?
@@satyamsingh3 what??
I didn't get your point?
#include
using namespace std;
class A
{
int a;
public:
void setData(int a)
{
this->a = a;
}
void getData(void)
{
cout
Harry bhai aapke brain me total language ke compiler fit kiye he..♥️😉
HARRY BHAI ARTIFICIAL INTELLIGENCE WITH PYTHON PAR EK SERIES BANAO NA PLEASE........
JO JO AGREE KARTA HAI LIKE KARE
YAHAN
Love you Harry Bhai !!!
Your class is always;
Best & interesting class ever !!! :)
Thanks harry bhaiya ek baar me samjh nhi aya tha but phir se dekhne pe Samjh aa gya 😃
Thank you Harry Sir for explaining the concept very clearly!
Bhaiya ish course ko advance tak le kr jaana or please data structures and algorithms bhi complete kra dena c++ se... Or Advanced level k projects bhihi btadena c++ k for job opportunities in big tech giants k liye..
And thank you so much bhaiya for all these courses...❤️❤️
plz reply return obj what does it mean by?
I love this course seriously
sir plz upload videos on polymorphism and operator overloading. also.my papers are going to held in august.your lectures are really helpful for me and i really want to complete your series.thanks .
Love your videos from Pakistan bhai ❣️
kon si college se ho bro Pakistan me
Harry bhai !!! Bigfan
harry bhi 8:00
agar hum & ko nahi lagaye to bhi run kar raha he to kya difference he & lagane se or nahi lagane se
---> agar kese or ko pata ho to pls reply me
Best👍 💞 c++ video ever
Best channel
sir you are the best mentor.i acually really wanted someone to teach c++ in VS code. and finally i reached your channel.
8:53 haa reference variable waala revise krna padega aaj
thanku so much harry sir. i have learnt c++ ,and i learnt all video c++ serial voice
Best tutorial bhaiya !! Please make tutorial on gsap
Thank you so much Harry bhaii!! I have learnt so many things from this playlist 🙌🏻🔥can't thank you enough:)
thank u bhaiya jiii❤❤❤❤❤❤😍😍
I didn't get anything in this video......this comment is only about this video
mai programming ko hate karta tha par ab maja aarha hai iam planing to make game in cocos studio Thanks @CODEWITHHARRY
god bless you sir🙏🙏🙏
#include
using namespace std;
class A{
int a;
public:
void setDataGarbage(int a){
a=a;
}
void setData(int a){
a=a;
this-> a=a;
}
void getDataGarbage(void){
cout
int main(){
If(harry==codemachine){
we=futurecoder;
}
else{
we=harry;
}
this is a very funny keyword, I kept laughing most of the time while watching the video and searching for same people.
|
^
Mai tera ye comment dekhke hnsa aur teko paagal samza
@@sudarshanmhaisdhune1039 Mujhe achha laga ki apko meri comment dekh ke khusi hui. But aapko mujhe pagal nahi samajhna chahiye tha, chalo samajh hi gaye toh koi baat nahi.
@@sudarshanmhaisdhune1039 By the way, I have made notes of C++. I you want that reply me.
Harry bhi you are absolutely great.love from Pakistan
Make some unique projects or games by the end of the course.....
I have tried to write a code in c++ wherein I have initiated a class called complex: handling the functionalities of the complex numbers. Also, in the setData(), I have taken the input from the user with the same name as that of the class member by making use of the this keywords that prevents the display of any garbage value on the screen as per the following lines of code. Besides, I have attached my code below for any reference and feedback:
CODE:
#include
using namespace std;
// class complex : handling functionalities of the complex numbers
class complex
{
protected:
int real, imag;
public:
void setData(int real, int imag)
{
// using the this keyword to prevent display of garbage values
this->real = real;
this->imag = imag;
}
void printData(void)
{
cout
pointer really fucks with your brain
It's cool "l will see you next time"🤘🤘🤘
Harry is one of best programer
harry Bhai STL kab padhoge....??
1. Operator overloading
2.virtual functions
??????
love u harry bro❤️❤️
Bhaiya game development with python mei aur bhi videos daalo
@CodeWithHarry
A setData(int a){}
A& setData(int a){}
Are these 2 same because I am getting the same output when I am using both. Which is more appropiate? According to what I have understood since we are returning a object first one would be more correct.
2:21 हैरी को चीजों को कॉम्प्लिकेटेड करने का शौक है।a रखना ही क्यू है ।दोनो हमसक्ल लेकर जाओगे तो लोग कंफ्यूज होंगे ही ,इसमें तो कई पिक्चर बनी हुई है तीन घंटे की।a = a करना ही क्यू? क्लास भी A ,int bhi a और फंक्शन argument भी a।
Please make it as a complete course
And upload more videos for completing this coursr
The great indian coder ! (Messiah of CSE students )
helpful video harry sir
Hi harry hope ur doing well
First of all i would like to say ur are an awesome instructor
I have been following ur web development course and ur phenomenal.
I had a request harry pls upload a complete course on C# not a one video course
Complete step by step from beginner to advanve level like ur web developemnt.
I am eagerly waiting for ur response
Thankyou
Ajaz
haa bhai mila kya response.
8:36 did not understand why .getData() is being invoked along with .setData(4) in the same line i.e line no.19.
Me too
Actually it's in this case "*this" is returning the the class A as an object and it when you write .getData it's point the getData function of the class which referring by this
@@sagnikroy5001 thanks👍
@@sagnikroy5001 it is compulsory that object name is same as class member name like"a". Please reply me.
@@sandeepkumartiwari8436 nope brother
Harry bhai nice best you tube channel
2:41 par ek achi baat thi koi error bhi nhi aaya tha usme
thanks bro, was really confused
Brother I want to know that will you add more videos on your web development course series? Pls reply bro and thanks for that awesome content👍
very nice🙌🙌 explanation and easy topic
🥳🥳🥳 thank you Harry bhai ✌️✌️
C#. Playlist banao please..bahut hi accha video raha ye wala
Luv u bhai😘
Q : Kia python se ham Android App bana sakte Jan .
Plz.... Answer
Yes but it is not recommended
Kiya c++ say hm Android app bna sktay hain?
Harry sir 👌👌👌👌👌👌
Harry Bhai Great Job, Could you please make multi-file C++ code, where some classes defined in another file and calling in main file!
Very nice harry bhai ❤
Love From Chandigarh🥰🥰
Cout
3:16 Apke sath reh reh kar apka theme bhi apki tarah intelligent ho gaya he. Ye error ko point kar raha hai. Notice that both the a have same theme, but when Sir applies the "this->" keyword it changes it's theme.
*Font
Thank you, Harry bhai
Thanks Harry Bhaiya
bro! this is a suggestion to please mention the last vedio on this tutorial or any tutorial in name.
Great Work Keep it up 👍💪👌
Sir konsa lhs ka baare maine baath kare hai 9:08 maine
Nice video
Bhaiya website bnana bhi sikha do for bussiness purposes
Thanku sir❤
I watched all your vides till now and it's really helpful ❤️❤️ thank you so much.
But I have a request ..can u plz upload a series of data structures and algorithms including some competitive programming stuffs..?
It will be a great help . Although u have dsa series too ....I aware of that
And that is really good in developing basic concepts ❤️
But it will be more helpful I f u plzz upload some CP stuffs..😀
Ps: Its just a request ...
Bcz I watched many youtube videos but it's only your channel where I am getting proper explaination so that's why I request you to start a CP and DS Algo series too..❤️❤️
Sir please make video on smart pointer and its types
Are course is complete
Thankyou so much 🙏
Thanku bro ❤😊
Please Upload next tutorial of Django blog on English channel as early as possible
Always support you sir
Upload next video Harry bhai
I waiting 😍😁
Harry bhai Data structures ke liye books suggest karo
Sir will u please create a playlist on ds and algorithms please sir
Yes. Just like reference in java
Codewallah
Hello Harry Bhai,Will you please make some fun projects in C++
Samajha gya 😌
Bhaiya files me opening reading and writing bhi pdhana
Watched 3 times this video still "this" is out of range
yes bro same situation
just understood first use
ke jab variable ka nam same ho vo vala case
Why is the operator overloading topic not covered??? isn't it important?
First of all thanks for this amazing classes.. and i have a question haw many videos in this playlists yet to come..????????? Plz reply.
Nice
Harry bhai i waiting for data structure
Sir ji ml ka next part kab aaega? plz sir reply kar do 🙇
Bhai seo pe ek dedicated video banao .
Please make Lectures on Java
why is the & operator used after A in the setdata function declaration ? Plzzz helppp anyone!!!
same doubt bro. Do you find the answer bro? Help me