Overview of this and previous video:- In previous video, we declared a function outside class and that function tried to access the members of class which is not possible. So we declared the function friend. In this video, we made 2 classes with their respective functions and the members/functions of one class tried to access the members of other class which is not possible. So we declared the members of one class the friend of other class or we can declare the whole class friend of other class. Rest is syntax which we need to understand.
@@anwesh07 'add' function is not trying to access the variables a & b in Complex class bcoz they have same name but they are stored in different memory location. Let us say if you have a class A with variable 'int a' in private & a function to set and display for 'a'. Now there is a function outside the class to display 'a' as well. In the parameter if you will write (int a) and {cout
//distance betwwen two points in coordinates system #include #include #include #include #include using namespace std; class Coordinates; class Distance{
You are very good teacher Maine aaj tak aapke jaisa koi teacher nahi dekha youtube par bhi aur kahi bhi Sachme aap ki padhane ki technic bahtreen hai 👌👌👌❤️❤️❤️❤️
@@artishsharma7859 Well as far as I could understand , he here declared calculator class before complex class which does not has a specific reason so if u do not wish to change the position of the class then u can do so but then u will have to Forward declare the Calculator class instead of Complex class, rest same.
we can also do like-- (for checking greater number in 2 classes) class A{ int a; //here we have declared the function as a frind funtion friend check(int a,int b); public: void read(int val1){ a=val1; } }; class B{ int b; friend check(int a,int b); public: void read(int val2){ b=val2; } void check(int a, int b){ if(a>b){ cout
Bhai main cheez thank u so much for zooming the program while typing ... Whenever the size is small it's difficult to see .. but next moment u zoom (ctrl +) it and u make everything easy , enjoyable and intresting ...❤️❤️❤️❤️👍👍🙏 Thank u so much
Nice video.But you didn't tell that why you placed calculator class above the complex class at time of error (at 5: 50). Because in stating we don't have to declare complex class at top and sum real function at bottom.And I got all points other than this and thanks for videos
By mistake he declared calculator class first,after that complex class. but in calculator class we have complex class as a datatype in one function which is not declared yet.So just declared complex class before calculator so that he doesn't get errors . Without re declaration you can just write calculator class after complex class.But sir explained alternative way if we don't want to change position of code. I guess 😀
It's because when declaring the friend functions, for scope resolution you obviously need to write thr name of the class calculator... And there the compiler will throw an error.. So it needs to be declared first.
I guess in class calculator We wrote int add(int a, int b){ return (a+b); is not really used to in program Also print function of class complex is not used . It can be used very well for smooth output and clearance. i wrote this comment after doing this lecture and practical experience. apologize if I'm wrong. My aim is not to provide any wrong info to anyone.
see despite of just forwarding declaration of complex class above than calculator class . We select to define the complex class and then calculator class. In this way we have full definition of complex class so we can access it directly in calculator function. Isn't it??
9:21 हैरी की बातो से ऐसा लगता है जो फनी वे में बात करु तो , कोई आदमी, एक एक करके पकोड़े बनाने की रेसिपी बताता हो ,और बीच बीच में कहे की ये चीज याद रखो ,ये याद रखो ।जब हम पूछे की भाई पकोड़े की रेसिपी क्यू याद रखे हमे तो चाय बनानी है ,तो फिर वो कहेगा ,वो ठीक है लेकिन अभी ये पकोड़े की रेसिपी याद कर लो काम आयेगी।
Hey harry, I just wrote the code for making an entire class as a friend and that's the code below, kindly check it and suggest some improvements: code: #include using namespace std; // creating a class complex to handle the complex numbers class complex; // by forward slashing // creating a class calculator to handle the mathematical functions class calculator{ public: void sumcomplex(complex c1,complex c2); // by forward slashing }; // defining the complex class over here class complex{ int a,b; public: void setnumber(int x,int y); // making an entire class as a friend // all functions of the class calculator can now access the private data of the class complex friend class calculator; }; void complex :: setnumber(int x , int y){ a = x; b = y; cout
Of course programming is hard. It's definitely not an easy task. But you have to learn it every day without skipping a day and constantly grind yourself then you will understand little by little everyday. c++ is quite hard than other languages like python, javascript,etc. So don't give up yet.
sir binary search tree class (BST) k lie aik video bna den kindy... apki sari videos dekhti hn me... thanku so much hamary lie ap aitna sb krty hen... may Allah help you to achieve your goals ameen... binary search tree me ye friend class smjha den plzzzz...
This type of content is only possible when you know the true goal of your life.
true
spammer
what is the true goal of life?
code with harry is far better than apna college
yes you are right
Agreee
Overview of this and previous video:-
In previous video, we declared a function outside class and that function tried to access the members of class which is not possible. So we declared the function friend.
In this video, we made 2 classes with their respective functions and the members/functions of one class tried to access the members of other class which is not possible. So we declared the members of one class the friend of other class or we can declare the whole class friend of other class.
Rest is syntax which we need to understand.
thanks, summed it up perfectly
@@zikrerasul7021 my pleasure ;)
Why "add" function is not made friend of "Complex" class.....bcoz it is also trying to access the private members of "Complex" class????
@@anwesh07 'add' function is not trying to access the variables a & b in Complex class bcoz they have same name but they are stored in different memory location.
Let us say if you have a class A with variable 'int a' in private & a function to set and display for 'a'. Now there is a function outside the class to display 'a' as well. In the parameter if you will write (int a) and {cout
@@anwesh07 no
You are one of the best programming teacher on UA-cam. Everywhere your name on the top in Programming.
Thanks a lot.
best tutorial on c++ literally
right!
So original
😎😎😎
Yeah!
!false
I want some practice questions for this tutorial
For every 12 hours a day , I am watching your video....
syntax hai bhai
//distance betwwen two points in coordinates system
#include
#include
#include
#include
#include
using namespace std;
class Coordinates;
class Distance{
public:
double Sqrt(Coordinates, Coordinates);
};
class Coordinates{
double a,b;
public:
void setNum(double x, double y){
a=x;
b=y;
}
friend class Distance;
};
double Distance :: Sqrt(Coordinates o1, Coordinates o2){
double sum=((o2.a-o1.a)*(o2.a-o1.a)+(o2.b-o1.b)*(o2.b-o1.b));
return sqrt(sum);
}
int main()
{
Coordinates o1;
Coordinates o2;
o1.setNum(1,0);
o2.setNum(1,0);
Distance calc;
double res = calc.Sqrt(o1,o2);
cout
You are one of the best coding teacher in INDIA
You are very good teacher
Maine aaj tak aapke jaisa koi teacher nahi dekha youtube par bhi aur kahi bhi
Sachme aap ki padhane ki technic bahtreen hai 👌👌👌❤️❤️❤️❤️
brushing up my programming knowledge ... it's really good! Thank you!
Why he is declaring calculator before complex plz explain
@@artishsharma7859 Well as far as I could understand , he here declared calculator class before complex class which does not has a specific reason so if u do not wish to change the position of the class then u can do so but then u will have to Forward declare the Calculator class instead of Complex class, rest same.
The course is very helpful especially for beginners, your way of explaining is very awesome and unique. I love this course.
Harry love your way of teaching this might take me to excellence in coding
🤩
lost a bit in between the video but till the end of video you cleared all the doubts
Thanks a lot for the whole series man
Topic :Competitive programming , please make video how much it is necessary and how can we continue it with development. Thank you.
Bro can u please tell me what topics should we learn to do problems of rating 1500 to 1800 in codechef
great learning from you literaly you make the tutorial very intresting without investing a single money
Ohhh my god! Really Harry sir to declare entire class as a friend is really amazing!
we can also do like--
(for checking greater number in 2 classes)
class A{
int a;
//here we have declared the function as a frind funtion
friend check(int a,int b);
public:
void read(int val1){
a=val1;
}
};
class B{
int b;
friend check(int a,int b);
public:
void read(int val2){
b=val2;
}
void check(int a, int b){
if(a>b){
cout
/*
By Bishal jaiswal
Purpose : Practicing (friend class);
*/
#include
#include
using namespace std;
class X
{
int x1, x2;
friend class Result;
public:
void setVal_X()
{
cout > x2;
cout > x1;
}
};
class Y
{
int y1, y2;
friend class Result;
public:
void setVal_Y()
{
cout > y2;
cout > y1;
}
};
class Result
{
float actualDistance;
public:
void printDistance(X o1, Y ob1)
{
actualDistance = sqrt((o1.x2 - o1.x1) * (o1.x2 - o1.x1) + (ob1.y2 - ob1.y1) * (ob1.y2 - ob1.y1));
cout
Friend function ki declaration me galti h
Argument b aagyega
friend class Result (X,Y);
@uYesser-ht3zx6oo3j
ONE OF THE BEST TEACHERS I THINK
Sir, this tutorial is very helpful for me.👍🏻👍🏻
Thank you for your amazing content Harry bhai it helps a lot!!
Superb class.... U r best programming teacher
harry bhai bhut achcha se samjh me aa rha h or pdne me mza bhi aa rha h
thanks for this................
love from GWAIOR (MADHYA PRADESH)
The best best tutor I ever got...🙏🏻✨💫
finally samajh agaya sir it is something tricky to understand !!!
Bhai main cheez thank u so much for zooming the program while typing ... Whenever the size is small it's difficult to see .. but next moment u zoom (ctrl +) it and u make everything easy , enjoyable and intresting ...❤️❤️❤️❤️👍👍🙏
Thank u so much
thank you for teaching in such a natural way
Alot of love from 🇵🇰🇵🇰🇵🇰
Nice video.But you didn't tell that why you placed calculator class above the complex class at time of error (at 5: 50). Because in stating we don't have to declare complex class at top and sum real function at bottom.And I got all points other than this and thanks for videos
ya i also has same doubt. If u know now , then plz tell me.
same doubt pls tell me
By mistake he declared calculator class first,after that complex class. but in calculator class we have complex class as a datatype in one function which is not declared yet.So just declared complex class before calculator so that he doesn't get errors .
Without re declaration you can just write calculator class after complex class.But sir explained alternative way if we don't want to change position of code.
I guess 😀
It's because when declaring the friend functions, for scope resolution you obviously need to write thr name of the class calculator... And there the compiler will throw an error.. So it needs to be declared first.
because compile don't know what is sumrealcomplex, it we define calculator class below complex class it gives error
.
Best programming teacher on youtube.
Harry bhai me to friend class ka concept bilkul bhi nhi janta tha but aapne bata diya, thank you 😊
Tume complexe number example use karke program understand bohot complex kr di
As always, AWESOME!
Thank you so much ..... God will always help you .... For your kindness.......
I guess in class calculator
We wrote int add(int a, int b){
return (a+b);
is not really used to in program
Also print function of class complex is not used . It can be used very well for smooth output and clearance.
i wrote this comment after doing this lecture and practical experience.
apologize if I'm wrong. My aim is not to provide any wrong info to anyone.
you said the right thing
Thank you Harry bhaiya for this kind of amazing videos
Google Ads : Are you interested in learning c- language?
.......
Me: No, I am interested in learning c-language from harry bhai.
But this is c++
@@gleanfact8318 LOL!
@@gleanfact8318 🤣🤣
@@gleanfact8318 savage
Every concept will be awesome if Harry Bhai teaches 🌈
this is so much complicated but finally i cleared it because i see this video 2,3 times atleast
Wow u explained it so good..like literally so good.thank u very much....
c++ is amazing. It provides those things which are out of syllabus for java.
Just amazing, I am from westBengal👌👌👌
Harry bhai your explanation are smooth as butter
I understood full concept in one go
Best explanation forever thanks for your big help
Thank you so muchh sir!❤❤😍😎
this video is going very complex to me
see despite of just forwarding declaration of complex class above than calculator class . We select to define the complex class and then calculator class. In this way we have full definition of complex class so we can access it directly in calculator function. Isn't it??
Awesome content and very easy to understand............
Bro you teach us from C++ E Balagurysamy book but your teaching skill is effective and excellent.Thnak you
Thank u Harry Sir 🙏
Great Explanation. Thanks for the video!
You are a gem!!!!!!💟
Why he is declaring calculator before complex plz explain
hi
phalana and dhimana was O P... though that friend's class topics were easy to understand, and it was due to your explanation!
Sir ji you r great thank u... 🌟
Nice explanation your videos are really good...please keep on making such videos.
15:50 bro i am not even surprised by this i can understand ke aapke andar ladoo foot rahe the uss time 🤣
btw good tutorials
Very helpful for us😊
14:15 sum dhimaka complex😂😂
Please make a video about c++ projects
9:21 हैरी की बातो से ऐसा लगता है जो फनी वे में बात करु तो , कोई आदमी, एक एक करके पकोड़े बनाने की रेसिपी बताता हो ,और बीच बीच में कहे की ये चीज याद रखो ,ये याद रखो ।जब हम पूछे की भाई पकोड़े की रेसिपी क्यू याद रखे हमे तो चाय बनानी है ,तो फिर वो कहेगा ,वो ठीक है लेकिन अभी ये पकोड़े की रेसिपी याद कर लो काम आयेगी।
This video is definitely one of the toughest ones I've come across so far.
Course sach mein bahut achha hai, but views ka difference dikh raha hai first video aur current video mein...bohot log quit kr dete hai
i know all these but theres always smthing new u would learn from his video.
Hey harry, I just wrote the code for making an entire class as a friend and that's the code below, kindly check it and suggest some improvements:
code:
#include
using namespace std;
// creating a class complex to handle the complex numbers
class complex; // by forward slashing
// creating a class calculator to handle the mathematical functions
class calculator{
public:
void sumcomplex(complex c1,complex c2); // by forward slashing
};
// defining the complex class over here
class complex{
int a,b;
public:
void setnumber(int x,int y);
// making an entire class as a friend
// all functions of the class calculator can now access the private data of the class complex
friend class calculator;
};
void complex :: setnumber(int x , int y){
a = x;
b = y;
cout
THANKS 🙏 HARRY BHAIYA
FOR AMAZING VIDEOS
Thanku bhaiya
1st time it did'nt clear so much but after watching the lecture 2nd time , all clear good work harry bhai>
Good one
Enjoying your video.
Thank you
Harry bhai, you are such a genius 👍
Sir mujhe kuch nhi ata tha c++ ..but ab bhut kuch aane laga h but..... practice ke liye concepts se related hw chahiye .....plx
Thank you sir 🙏🙏
LOVE YOU HARRY BHAI!!!
Harry hai to sab mumkin hai 😀❤️❤️
Thanks.
Bhi aap he batlay the agar declear kr rhe to ushke under ::--->
(complex o1 , complex o2);
Yha -> o1 ,o2. likeh ya nahi likhe koi farq nahi pdega.
sir app boilerplate jaisi tips and tricks short form mein kaat ke upload kardo easy ho jayega for people to find out
Best course ❤️🙏
@CodeWithHarry bhai code likhte vaqt zoom kiya karo, bahot badiya kam hoga
Thankyou, it helps.
Boilerplate video is worth watching. It saves lot of time
Thankyou Soo much 💙
4 time dekha Video ko Tab Jaake Samjha Mara Dimag Mujhse Kehta hain : kya Programmer banega re Tu 😔
same😂😂😥
I know few people who don't even try to learn and call themselves future programmers.
So what can do guys 😥
Of course programming is hard. It's definitely not an easy task. But you have to learn it every day without skipping a day and constantly grind yourself then you will understand little by little everyday. c++ is quite hard than other languages like python, javascript,etc. So don't give up yet.
@@ananddesai9020kya hua bhai bane ki nahi programmer
great course
Thanks a lot ❤️❤️❤️❤️
this man is making these hard topics as easy as watching a intresting vine, one like for him 👍
Thank YOu Harry Bhai .
Classy Tutorial..
Rohan Das ..Do you know sir personally ?? he has mentioned your name in many videos :)
Omago rohan das mil gya.
@@dangergamimg1933 😂😂😂
Yahi hai rohandas iske Chanel par jaake dekho isne code with harry ko add rakha hai 😂😂😂
Binary operator and operator overloading k lecture b provide kr dain
I saw this vedio 5 times then I got understand
You are great sir
thank you bhaiya!!
what a nice explanation bro
Hi Harry, Please make video on Angular and React...………….
sir binary search tree class (BST) k lie aik video bna den kindy... apki sari videos dekhti hn me... thanku so much hamary lie ap aitna sb krty hen... may Allah help you to achieve your goals ameen... binary search tree me ye friend class smjha den plzzzz...
After finishing your C 15 hours tutorial within 30 days now watching this :)
Was it helpful? Can I prefer watching that?
Thank you so Harry bhaiya, for making such informational video..
you are great wallah
thank you so much bro