Friend Functions in C++ Programming | Object Oriented Programming in C++

Поділитися
Вставка
  • Опубліковано 13 гру 2024

КОМЕНТАРІ • 174

  • @SimpleSnippets
    @SimpleSnippets  5 років тому +22

    Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌

  • @OmegaJazz
    @OmegaJazz 6 років тому +85

    Great Lecture bro. IDK why my teachers can't teach so well. He just comes in the class with slides and just literally reads out the slides.

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +16

      Hehe thanks buddy. I'm glad you liked this video. Well about the other teachers, everyone's got different styles, can't really blame them anymore especially now when you have other options like this UA-cam video and many others resources online 😉
      BTW I also have an article on our official website on this topic if you want to prepare answer ✌️
      Link in the description 😇

    • @arnavsaha3631
      @arnavsaha3631 2 роки тому +1

      Same

  • @ដង្កូវសៀវភៅ
    @ដង្កូវសៀវភៅ 4 роки тому +10

    Well done bro. I’ve gone through friend function with my lecturer about 5 months ago and got nothing but now I’m here be able to use friend function clearly. Thanks a lot and always support you and your videos.

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому +1

      Glad I could help! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇

  • @heartsonny
    @heartsonny 2 роки тому +2

    Your explanations are so clear. Thanks !!

  • @jamesnash9675
    @jamesnash9675 2 роки тому +1

    you are the best..........masum

  • @theears995
    @theears995 3 роки тому +5

    Thank you! This is an amazing explanation - the friend keyword always confused me, and now I finally understand it!

  • @LegitSpartaN118
    @LegitSpartaN118 3 роки тому +4

    Absolutely great videos that have helped me pass my C++ at university, great stuff bro

    • @SimpleSnippets
      @SimpleSnippets  3 роки тому

      Oh that's amazing to know. Please do share the videos with your friends and juniors too. It might help them as well 😊

  • @neerajmahapatra5239
    @neerajmahapatra5239 5 років тому +14

    You have a great talent ...your videos will be universally viral ..
    Your way is simple.
    Your english is awesome..
    You are really a good teacher..
    Just keep on making video...
    My first earning after i will become app developer will be to you and saurabh shukla sir...(my sirg).....😍😍😍

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Thanks Neeraj, your comments and support means a lot to me 😇

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Do let me know about your app as well. Surely will be happy to know about it 😊

    • @neerajmahapatra5239
      @neerajmahapatra5239 5 років тому

      @@SimpleSnippets ya sure sirr

  • @n_rounder6192
    @n_rounder6192 3 роки тому

    Great help when exams are coming
    Thank you sir

  • @harshvardhansingh780
    @harshvardhansingh780 3 роки тому

    No words to say .... fabulous video

  • @hoorainnoor1353
    @hoorainnoor1353 4 роки тому +3

    a good tutorial i build this program on codeblocks so their is no error it runs successfully and gives the out put same like your

  • @swithikamutyam4976
    @swithikamutyam4976 4 роки тому +2

    Superb explanation!
    The way you teach is so simple and much easier to understand.

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому +1

      Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇

  • @pritishpattnaik4674
    @pritishpattnaik4674 Рік тому

    crystal clear explanation bro

  • @vidhioswal9188
    @vidhioswal9188 3 роки тому +1

    Explained it so well , thank you!

  • @aayushadhikari7851
    @aayushadhikari7851 3 роки тому +1

    GOD level teaching

  • @vedangkavathiya8426
    @vedangkavathiya8426 4 роки тому +2

    Thanks brother...
    Nice explanation...🙂

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому

      Welcome 😊Please support me by sharing our videos with your friends too bro ✌

  • @vu5700
    @vu5700 4 роки тому +2

    Amazing tutorial,good job sir :)

  • @UsamaKhan-ct4bc
    @UsamaKhan-ct4bc 2 роки тому

    very good teacher. really appreciate.

  • @easyconcept5677
    @easyconcept5677 Рік тому +1

    craaa gl baat!👌

  • @308_akashsharma2
    @308_akashsharma2 4 роки тому +1

    thanks you! this lecture cllears my doubt.

  • @prasannas8883
    @prasannas8883 6 років тому +7

    Because of you I would get get good marks in cs..Thank you😊

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +2

      Thank you so much buddy. You really made my day by this comment 😇🙏
      Means a lot to me. Do share the videos with your friends too ✌️

  • @sunnyjain630
    @sunnyjain630 5 років тому +1

    very simple and easy way of explanations!!
    it all clear my doubts about friend function thank you boss!!

    • @SimpleSnippets
      @SimpleSnippets  5 років тому +2

      That's amazing to know Sunny 😇 thanks for this wonderful feedback. Please do share the videos with your friends too 👍

  • @that_paper
    @that_paper 7 місяців тому

    Great explanation

  • @vedantghate92
    @vedantghate92 3 роки тому

    you are superb bro.......

  • @abdulqadoos80
    @abdulqadoos80 3 роки тому

    Outstanding bro

  • @ajgamer3888
    @ajgamer3888 3 роки тому

    That was great and wonderful explaination from scratch.. well done bro👍👍👍

  • @himanshubhatt6240
    @himanshubhatt6240 3 роки тому

    Loved this🧡♥️

  • @kanhiyamittallyrical
    @kanhiyamittallyrical 3 роки тому

    Thanku sir, great explanation 👌

  • @davirafaelfranke9303
    @davirafaelfranke9303 4 роки тому +4

    thank you very much for this video! i had a question on my college test asking this
    can you also explain what is a client class? id be pleased

  • @lokanathanganesan6070
    @lokanathanganesan6070 3 роки тому

    Thank you sir. The explanation was nice and I can understand them easily.

  • @adnanrasheed4366
    @adnanrasheed4366 9 місяців тому

    Thank you very Much sir

  • @kunalbahirat7795
    @kunalbahirat7795 2 роки тому

    Those who do not know about the access specifiers (public,private,protected). first watch that video and then come here. for better understanding!!

  • @swarupaswaru4361
    @swarupaswaru4361 6 років тому +1

    Really excellent it is helpful for tomorrow's exam thank you for this

    • @SimpleSnippets
      @SimpleSnippets  6 років тому

      Thank you so much for such a positive feedback. I'm glad this will be helpful for your exam. Please share this with your friends too as even they will get help from this 😇
      Ohh and all the best 😇✌️

    • @swarupaswaru4361
      @swarupaswaru4361 6 років тому

      Tanq

  • @laibahameed4212
    @laibahameed4212 2 роки тому

    God bless you,so much honour and likes 🤩from Pakistan🇵🇰🇵🇰

  • @tanzengyang3760
    @tanzengyang3760 4 роки тому

    Actually we declare void Distance::addValue {} if we want to access outside class ...C++ is so confusing. nice explanation..

  • @Durgasivakumaran
    @Durgasivakumaran 3 роки тому

    😍all videos👌

  • @oscarwang7920
    @oscarwang7920 5 років тому +1

    Nice work bro !

  • @nirajjain04
    @nirajjain04 5 років тому +1

    Explanation level 999!💥😅

  • @Selva-bx9iy
    @Selva-bx9iy 4 роки тому +1

    Ur amazing bro❤

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому +1

      Thank you so much Selva. Glad to hear this from you. :-)
      Please do share the videos with your friends too & hope you have subscribed. Thats the biggest help and support you can provide :-)

  • @GameingYKSipa
    @GameingYKSipa 5 років тому

    I loved ur explanation ❣️

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Thank you so much bro, Please do share the videos with your friends too bro. That will be the biggest help & support 😇

  • @sreehari4485
    @sreehari4485 3 роки тому +1

    Pever💥

  • @_ARITRIKABISWAS
    @_ARITRIKABISWAS 3 роки тому

    Thank you

  • @saugatthapa6295
    @saugatthapa6295 5 років тому +2

    #include
    using namespace std;
    class distance{
    private:
    int meter;
    public:
    distance(){
    meter = 0;
    }

    void disp(){
    cout

    • @adarshtodi1158
      @adarshtodi1158 5 років тому

      @muhammed sahad ibn abdul samad same problem.. found any solution?

    • @akashshaw1594
      @akashshaw1594 5 років тому +2

      Change your class name to Distance or something else bcoz your current class name 'distance' is clashing with another symbol from namespace

    • @G__BagulSamruddhi
      @G__BagulSamruddhi 3 роки тому

      @@akashshaw1594 thank you sm! this helped!!:)

  • @NormieMob
    @NormieMob 5 років тому +1

    Tomorrow I have practical exam helped me understand

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Thats great to know buddy, please do subscribe& share the video with your other friends too :-) 😇

  • @RahulCarpenter
    @RahulCarpenter 6 років тому +1

    great bro!!
    Keep Uploading🙌🙌

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +1

      Thank you so much brother 😇
      I would request you to please share the video with your friends and contacts 😇

    • @RahulCarpenter
      @RahulCarpenter 6 років тому +1

      ​@@SimpleSnippets definitely bro!!

    • @SimpleSnippets
      @SimpleSnippets  6 років тому

      Thank you so much bro 👍

  • @funnkidunyan1940
    @funnkidunyan1940 3 роки тому

    How you speak flowly👌🏻

  • @hihi1124
    @hihi1124 6 років тому +4

    Will you make tutorials with data structures like stacks, binary tree and SLL or DLL?

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +4

      Yes definitely, infact in a recent video where I updated all channel subscribers, I said I will be covering 3 subjects on priority and asked for suggestions. The 3 subjects are Core Java, DS with C++ and C# .NET.
      So yes Data structures will soon be covered completely on the channel ✌😇

  • @armv7-m603
    @armv7-m603 7 років тому +2

    Thanks

    • @SimpleSnippets
      @SimpleSnippets  7 років тому +1

      You're always welcome. Do share the videos with your friends and contacts :-)

  • @siddhigolatkar8558
    @siddhigolatkar8558 4 роки тому +5

    I'm currently not working so I am not in a position to donate as of now but the least I can do is to watch ads.

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому +2

      You don't have to donate ever 😊 but please keep sharing our channel & videos with your friends. That's the biggest help & support you can provide 👍✌️

  • @lotsoflols6822
    @lotsoflols6822 5 років тому +1

    Keep it up👍

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Thank you so much, please do subscribe and share the video with your friends too. Thats the biggest help and suport you can provide in return😇

  • @okprogrammer
    @okprogrammer 6 років тому +2

    please make a video on "this" pointer in c++. And you are aswesome!!

  • @NormieMob
    @NormieMob 5 років тому +1

    Good video

  • @hamzajlassi2845
    @hamzajlassi2845 5 років тому +1

    like the intro bro

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Thats great to hear buddy, Please do subscribe and share our channel with your friends too! Thats the biggest help and support 😇

  • @thephysicist989
    @thephysicist989 3 роки тому

    Out of curiosity, how does your visual studio look so old? I actually like that classic look

  • @okkhot479
    @okkhot479 4 роки тому +1

    Which software u have used for code

  • @akshatvyas2594
    @akshatvyas2594 4 роки тому

    Why passing d1 argument in addValue function.

  • @Blooderstokizz
    @Blooderstokizz 4 роки тому +1

    Best indian guy ever

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому +1

      Haha thanks buddy, highly obliged to have such a title ❤😇

  • @nashhash4625
    @nashhash4625 6 років тому +2

    cout

  • @aarjavbaxi2299
    @aarjavbaxi2299 4 роки тому +1

    i didnt understand what does that (distance &d); mean..can someone explain??

  • @kunalsakhare7538
    @kunalsakhare7538 5 років тому +2

    In program I got a error -
    Void addValue function is showing error saying - reference to Distance is ambitious.

  • @sandrokan89
    @sandrokan89 6 років тому +1

    One thing does not make sense to me, and that's something I've seen being done in every "friend function tutorial"...
    WHY do you put the friend function in the public section of the class?
    Isn't that redundant, as a public function can be accessed "publicly" (just like the 'get' and 'set' methods)??
    Would the code still work if you were to put the public function in the private section?

    • @cosmicgyan6732
      @cosmicgyan6732 4 роки тому

      We need to access private data of a class that's why

  • @anushkaaggarwal2972
    @anushkaaggarwal2972 4 роки тому +2

    i am having an error. when i defined the addvalue function, it showed that reference to distance is ambiguous. please help

    • @hypermeero4782
      @hypermeero4782 4 роки тому

      me too
      try this out , it will work tho..
      #include
      using namespace std;
      class test{
      private:
      int data1,data2;
      public:
      test(); //Default Constructor
      test(int a , int b){ //Parameterised Constructor which is Constructor with arguements
      data1 = a;
      data2 = b;
      }
      void display();
      friend void multiply(test); //Friend Function (doesnt matter where you initialize it)
      };
      //End of class
      void test::display(){
      cout

    • @ashishkatyal
      @ashishkatyal 4 роки тому +3

      Make the first letter of the class name capital

    • @paramgill2712
      @paramgill2712 4 роки тому

      @@ashishkatyal it worked thankks, but can u explain why so?

    • @ashishkatyal
      @ashishkatyal 4 роки тому +2

      @@paramgill2712 I'm glad it helped. You can declare it with lower case, but it may not work in some compilers as the convention is to start with a capital letter. The conventions were created to make it easier on others to read and understand your code.

    • @kunalagarwal4473
      @kunalagarwal4473 4 роки тому +1

      @@ashishkatyal thanks buddy it worked :-)

  • @kannadasanr9849
    @kannadasanr9849 4 роки тому

    Hai bro , I want to learn component object modeling in C++ . Do you have any video tutorials for that. Or just give me suggestions for how to begin.

  • @Mahesh-wr6uc
    @Mahesh-wr6uc 5 років тому

    Sir can you kindly provide vedios on dynamic data structures in c++

  • @BringMe_Back
    @BringMe_Back 3 роки тому

    Nice 🤤, thanks

  • @mahesh-jg3zx
    @mahesh-jg3zx 5 років тому

    Sir what is the use of & symbol why we are using it

  • @sponge8697
    @sponge8697 5 років тому

    Hi. Do u need to pass the ostream “cout ” to displayData function in your class?

  • @bestsaurabh
    @bestsaurabh 4 роки тому

    Can we have a friend class as well to access private members just like the friend functions?

  • @thefive.am.c
    @thefive.am.c 2 роки тому

    isn't the friend function declared inside the class , sir ??

  • @syedimadhaqqi4340
    @syedimadhaqqi4340 5 років тому +1

    Good lecture. I am getting an error when I implement your program. It is:
    error: 'int Distance::meters' is private. What does this mean. I cannot run the program. Also, I have to use #include
    and getch() to see a result, otherwise the output screen pop up and vanishes. Does not stay like your output screen. Do you know how I can get a output without this. My program is written below: Thanks
    #include
    #include
    using namespace std;
    class Distance
    {
    private:
    int meters;
    public:
    Distance()
    {
    meters=0;
    }
    void displayData()
    {
    cout

    • @internetzz2322
      @internetzz2322 5 років тому

      Change the return type from void to int , for the friend function it should work

    • @syedimadhaqqi4340
      @syedimadhaqqi4340 5 років тому

      @@internetzz2322 Still same problem

  • @timewrath7723
    @timewrath7723 4 роки тому

    So, what else does a friend function do, aside from being able to access private elements? I'm not sure what else the friend function did in the main() function.

  • @farahhamid360
    @farahhamid360 5 років тому +1

    Plz upload a video about dynamic variables (pointers) 🥺🥺🥺

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      I already have that in this C++ programming playlist. Do check it out :-)

  • @abdullahawanz_278
    @abdullahawanz_278 3 роки тому +1

    Love from pakistan🖤

    • @SimpleSnippets
      @SimpleSnippets  3 роки тому

      Thanks buddy, I'm glad to hear this. Please do share the videos with your friends too. That's the biggest help and support you can give back to me 🙏😊

  • @patjiyane6906
    @patjiyane6906 6 років тому

    Can a friend function declaration prototype be declared with no return type?
    friend Rectangle duplicate (Rectangle & rect1, Rectangle & rect2);
    duplicate (foo, bar);

  • @BushraFatima-w3e
    @BushraFatima-w3e 4 місяці тому

    I am facing an error when i compile and run the code i.e reference to 'distance' is ambiguous

  • @ameelaaslam7328
    @ameelaaslam7328 5 років тому +2

    Guys Mara final paper ha oop ka or kuch ata e ni abi tk , ab ma try kr ry hyn k prepare ho jy please dua kryn Mary liy

  • @amannagar1108
    @amannagar1108 5 років тому +1

    U r top good

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Thanks Aman😊 glad to hear this feedback bro ✌️

  • @mohammedzayedkhan9685
    @mohammedzayedkhan9685 2 роки тому

    Friend is declared inside the class

  • @allareintomyworldofinventi3117
    @allareintomyworldofinventi3117 3 роки тому +1

    what are you studying now bro

    • @SimpleSnippets
      @SimpleSnippets  3 роки тому

      The next topic that I have to make video on 😜 (Data structures and algos basically)

  • @ismailbajrami7478
    @ismailbajrami7478 5 років тому

    how this program runs in the line 12 the variable name is meter but in the privat its meters ? i expected and error but ok

  • @divijsamuel7229
    @divijsamuel7229 4 роки тому +1

    cant we name the constructors with a name different than the class??

  • @sabahatfaria168
    @sabahatfaria168 6 років тому +1

    Plz explain a bit about friend classes as well
    i hope i can make a request after all there is a specific quota for "ON DEMAND VIDEOS"😊🤗

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +1

      Definitely, I'll create one video on this topic for sure 😇
      And yes there is always an on demand option for all of viewers and subscribers 😇✌️

    • @sabahatfaria168
      @sabahatfaria168 6 років тому +1

      Thnx for ur attention on my small request🤗🤗

    • @sabahatfaria168
      @sabahatfaria168 6 років тому +1

      Kindly try to make my requested video before 16 may
      after all i need your help for my exam🙂🙂

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +1

      I will try to post this video by day after tomorrow 😇✌️

    • @sabahatfaria168
      @sabahatfaria168 6 років тому +1

      Thnx alot once again
      working like that will definitely make one to pray for u😊😊

  • @sirisagar3606
    @sirisagar3606 4 роки тому +1

    bro can you clear my doubt- what is function of cpp

  • @Nikhil-yi3qc
    @Nikhil-yi3qc 4 роки тому

    Which IDE are you using?

  • @onezaalvi9866
    @onezaalvi9866 4 роки тому +1

    levellllllllllllllllllll

  • @bhairavaswami7897
    @bhairavaswami7897 5 років тому +1

    Sir please explain slowly,we canot move with your speed

    • @SimpleSnippets
      @SimpleSnippets  5 років тому

      Agreed, I will make sure to go slow in future. Sorry for the inconvenience

    • @Goat-gamerzz
      @Goat-gamerzz 4 роки тому +1

      i think your speed is pretty good , i watch your vids at 1.8 speed

  • @turdle69420
    @turdle69420 5 років тому +1

    "nice intro" - no one

  • @himanigulati6922
    @himanigulati6922 4 роки тому +1

    i am gettin so many errors. although i have written the exact same code!

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому

      Well in the video things worked out without errors isnt it ? So IDK how come you are getting so many errors 😅
      Check the video description for the full code and cross check it again maybe ✌

    • @himanigulati6922
      @himanigulati6922 4 роки тому

      @@SimpleSnippets can i send you the error its showing somewhere else?

    • @SimpleSnippets
      @SimpleSnippets  4 роки тому

      @@himanigulati6922 I don't debug others code so don't expect me to solve your queries and errors, but still you can DM me via our Instagram page - instagram.com/simplesnippets
      Or mail me at - simplesnippetsinfo@gmail.com

  • @ashwiniuppin5007
    @ashwiniuppin5007 6 років тому +1

    Sir what is your qualification ????☺

    • @SimpleSnippets
      @SimpleSnippets  6 років тому +4

      I completed my post grad - masters in computer applications a year back! MCA ✌️
      Although I don't think qualifications matter 😛

  • @vineetjindal6582
    @vineetjindal6582 3 роки тому

    explain in Hindi also

  • @venkateshojha5520
    @venkateshojha5520 4 роки тому

    It will be greatful if u a create watsapp grp

  • @Kennerdoll
    @Kennerdoll 3 роки тому

    bro take it easy data you have but you are too fast

  • @ArvindLohar-h2k
    @ArvindLohar-h2k Рік тому

    very poor explanation first get advanced and learn how to use vs code.

  • @oldschoolgamer6941
    @oldschoolgamer6941 4 роки тому +2

    thanks

  • @gouravmajee9913
    @gouravmajee9913 3 роки тому

    thank you