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
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 👌👌👌❤️❤️❤️❤️
//distance betwwen two points in coordinates system #include #include #include #include #include using namespace std; class Coordinates; class Distance{
@@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
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.
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.
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
Harry Sir , You tech the c++ very well and i really appreciate your work. but i noticed that the videos are take too long to evaluate the small topic. so i really appreciate if u solve this issue and give us more content in future like this. Thanks in advance .
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.
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
best tutorial on c++ literally
right!
So original
😎😎😎
Yeah!
!false
You are one of the best programming teacher on TH-cam. Everywhere your name on the top in Programming.
Thanks a lot.
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
For every 12 hours a day , I am watching your video....
syntax hai bhai
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 👌👌👌❤️❤️❤️❤️
I want some practice questions for this tutorial
//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
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.
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
Ohhh my god! Really Harry sir to declare entire class as a friend is really amazing!
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
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
🤩
Harry bhai me to friend class ka concept bilkul bhi nhi janta tha but aapne bata diya, thank you 😊
great learning from you literaly you make the tutorial very intresting without investing a single money
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
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)
ONE OF THE BEST TEACHERS I THINK
finally samajh agaya sir it is something tricky to understand !!!
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 🌈
Sir, this tutorial is very helpful for me.👍🏻👍🏻
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 your amazing content Harry bhai it helps a lot!!
Superb class.... U r best programming teacher
The best best tutor I ever got...🙏🏻✨💫
/*
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
As always, AWESOME!
thank you for teaching in such a natural way
this is so much complicated but finally i cleared it because i see this video 2,3 times atleast
Best programming teacher on youtube.
Awesome content and very easy to understand............
Just amazing, I am from westBengal👌👌👌
Alot of love from 🇵🇰🇵🇰🇵🇰
Thank you so muchh sir!❤❤😍😎
Thanku bhaiya
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
thank you bhaiya!!
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
.
Thank you sir 🙏🙏
Harry bhai your explanation are smooth as butter
You are a gem!!!!!!💟
Why he is declaring calculator before complex plz explain
hi
Thank u Harry Sir 🙏
c++ is amazing. It provides those things which are out of syllabus for java.
Harry hai to sab mumkin hai 😀❤️❤️
Thankyou Soo much 💙
Thank you so much ..... God will always help you .... For your kindness.......
Wow u explained it so good..like literally so good.thank u very much....
Enjoying your video.
Thank you
Very helpful for us😊
Thanks a lot ❤️❤️❤️❤️
Great Explanation. Thanks for the video!
Sir ji you r great thank u... 🌟
I understood full concept in one go
Bro you teach us from C++ E Balagurysamy book but your teaching skill is effective and excellent.Thnak you
This video is definitely one of the toughest ones I've come across so far.
Nice explanation your videos are really good...please keep on making such videos.
Thank YOu Harry Bhai .
great course
After finishing your C 15 hours tutorial within 30 days now watching this :)
Was it helpful? Can I prefer watching that?
pinky tum mera msg dekh rhi ho toh mujhko maaf kardo coding woding mere bas ka nhi.....shadi karke khus rehna kisior se kyu ki abba toh nhi manenge
Moye moye 😢😢
😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂 0:31
Bechari pinki
Bhai tum yai jajha mila ha ashki koo. Inti social media application haa bro
RIP Pinky 🎉
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
Good one
Best explanation forever thanks for your big help
1st time it did'nt clear so much but after watching the lecture 2nd time , all clear good work harry bhai>
Thanks.
Tume complexe number example use karke program understand bohot complex kr di
THANKS 🙏 HARRY BHAIYA
FOR AMAZING VIDEOS
phalana and dhimana was O P... though that friend's class topics were easy to understand, and it was due to your explanation!
thank you so much bro
Well done boss😊
LOVE YOU HARRY BHAI!!!
this video is going very complex to me
Thank you bhai 🙏
Harry Sir ,
You tech the c++ very well and i really appreciate your work.
but i noticed that the videos are take too long to evaluate the small topic.
so i really appreciate if u solve this issue and give us more content in future like this.
Thanks in advance .
i know all these but theres always smthing new u would learn from his video.
It takes 2 days 50 time rewinding the video to understand the whole thing ❤️. Belive me he did his best nd did nothing wrong.
Real
Thanks vro 👍👍
Thankyou, it helps.
Best course ❤️🙏
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
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 😂😂😂
Nice explanation
what a nice explanation bro
Awesome ❤
Thankyou sir ♥️
amazing videos Harry Bhaiya !!!!!!!!
Harry bhai, you are such a genius 👍
this man is making these hard topics as easy as watching a intresting vine, one like for him 👍
good harry bhai ek number
Boilerplate video is worth watching. It saves lot of time
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
❤️ thank you❤️
love you sir!!!
Harry bhai aap great ho 🙂
Majjaa AAA Raha hai bhaiya ❤
you are great wallah