Friend Function | CPP Object Oriented Programming Video Tutorial

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

КОМЕНТАРІ • 70

  • @onuberonly7846
    @onuberonly7846 8 років тому +6

    Thank you for your videos. I was able to use your videos to revise my c++ skills from many years ago to get a job. I would like to add from experience one can go through life as an c++ developer and never have to use friend functions or inheritance...But It's good to know it!!

  • @aakanksha2605
    @aakanksha2605 4 роки тому +6

    I always smile at the String error 😊🥰....so sweet error...n ur tutorials as usual amazing 🤗💛

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

      😊 thank you

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

      @@LearningLad we shud thank you for taking time for sharing ur knowledge thank you so much sir❤️

  • @dreamdustproduction2453
    @dreamdustproduction2453 8 років тому +19

    a sweet error of String every time 😁😁😁. all videos are great .
    I understand c++ only from these videos thank you sooo much sir
    ...

    • @LearningLad
      @LearningLad  8 років тому +8

      Thank you.
      i'm really glad that my tutorials are helping you :)

  • @sidhuparas
    @sidhuparas 8 років тому +4

    Really useful tutorials.... preparing for exams from your channels.

  • @nikhilevin
    @nikhilevin 8 років тому +20

    You're a fan of Bucky Roberts.. aren't you?

  • @pankajkalwani9369
    @pankajkalwani9369 7 років тому +2

    awesome videos! I thought c++ is difficult but these video cleared all my concepts.

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

    thanks for this video i am software engener in microsoft usa

  • @LetCode96666
    @LetCode96666 9 років тому +4

    AWSOME ! this video helped me to understand friend function properly :D

    • @LearningLad
      @LearningLad  9 років тому +2

      +Shahriar Rahman
      awesome :)

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

    I think so you have the habbit of java that's why everytime making 's' capital 😁 . Your videos are very much helpful for me thanks alot 😊

  • @Amarkumar-bb2uq
    @Amarkumar-bb2uq 6 років тому +5

    what are you using "void tellme" function for?

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

    Sir,what is the difference between using "friend" keyword and scope resolution operator(::)??

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

    yOU'RE ALWAYS AWESOME

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

    Thank you so much sir ❣️

  • @pankajkalwani9369
    @pankajkalwani9369 7 років тому +3

    Even i am following every video and making all the programs in codeblocks

    • @LearningLad
      @LearningLad  7 років тому +3

      im really glad that my tutorials are helping you :)

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

    Thank you so much, sir

  • @rodwynnejones
    @rodwynnejones 5 років тому +3

    whats the difference between a "friend function" and "defining a method outside a class definition using the scope resolution operator" as done in one of your other videos?

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

      You can say that when using scope resolution it's just like you'd declare the method publicly inside the class. The difference of a friend function it's that the friend function can be called with other parameters, those that are not exclusive members of the class. So you can use the friend function with global variables and local variables of main, which you cant with the function declared with the scope resolution operator for the class.

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

    Hi Anil Sir, your video was informative. Since you have so many subscribers may I suggest you to be a little careful about indentation. Since, so many people are watching your videos they might pick up not taking code indentation seriously!

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

    This is nice tutorial
    it would be much better to understand if syntax and definition are added as well.
    other wise everything is well.

    • @LearningLad
      @LearningLad  7 років тому

      Thank you for the suggestion.
      will consider it for upcoming video's :)

    • @LearningLad
      @LearningLad  7 років тому

      Thank you for the suggestion.
      will consider it for upcoming video's :)

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

    Nice Lecture

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

    In this example, what would be the difference in making setter/getter functions and using this friend function way???

  • @saadtanveer911
    @saadtanveer911 8 років тому +2

    why we have passed anil as a parameter to call display function in main() ????

  • @tamilkeyboardlessons3505
    @tamilkeyboardlessons3505 9 років тому

    sir will you take tutions for a large set of students

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

    what is the use of tellme function

  • @bodlanikhilesh6332
    @bodlanikhilesh6332 7 років тому

    As you passed instance of Human as a parameter in a function,so it is not needed to do like (man.diplay()),Is it the way I thought

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

    Are friend classes bidirectional? i.e. both classes can access each others members?

  • @abhishekgautam9673
    @abhishekgautam9673 10 років тому +2

    thnx sir

    • @LearningLad
      @LearningLad  10 років тому +1

      Abhishek Gautam
      pleasure man :)

  • @udhaya7206
    @udhaya7206 9 років тому

    sir here is it mandatory to pass the object ?? instead can v use cal by reference?

  • @PflanzenChirurg
    @PflanzenChirurg 7 років тому +2

    awesome videos ;)

  • @youssefel-shabasy833
    @youssefel-shabasy833 6 років тому

    TY

  • @Peterpamela91
    @Peterpamela91 9 років тому

    Hi Sir, before I watch this video, I were learning OOP from other websites. I find a difference in friend function declaration. In your video, you declare friend function as - friend return type function name (class_name object_name) like " friend void display(Human man)".
    However, in this following website :
    www.cplusplus.com/doc/tutorial/inheritance/
    The writer declare friend function as - "friend Rectangle duplicate (const Rectangle &)"
    Therefore, I have 2 questions that I would like to know
    1. In friend function declaration, what is the meaning of "&" in the function input argument?
    2. In friend function definition, what is the meaning of "Rectangle& param" in the function input argument?
    Thanks.

  • @ganeshkarthi1813
    @ganeshkarthi1813 9 років тому +1

    what compiler u use pls send me the link or just say compiler name sir

    • @LearningLad
      @LearningLad  9 років тому +3

      ganesh karthi
      i'm using mingw toolset.
      checkout this video to download and install codeblocks along with mingw.
      ua-cam.com/video/MDJ9uEHDhfU/v-deo.html

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

    Anil😍

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

    why do we need to use friend function, why can't we just do scope resolution?

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

      What you're saying if I'm correct is to use the scope resolution operator to define the function outside the class. In the example shown by this video, you could just do that but realise that friend functions are very useful in operator overloading.

  • @tuvshin666
    @tuvshin666 10 років тому +2

    Download link pls

    • @LearningLad
      @LearningLad  10 років тому +1

      Dire Red
      if you are asking link for the source code
      checkout www.learninglad.com/p/cplus-plus-free-video-tutorials.html
      if you wanna download this video then you have to use any youtube video downloading software's.

    • @tuvshin666
      @tuvshin666 10 років тому +1

      ty

  • @ayushman_sr
    @ayushman_sr 7 років тому +2

    man is class ??

    • @LearningLad
      @LearningLad  7 років тому +2

      Human is a class.
      man is just an object.

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

    Sir I'm having an error in my program:
    /*Friend Functions*/
    #include
    #include
    using namespace std;
    class Human
    {
    //private access specification by default, if nothing written
    string name;
    int age;
    public:
    Human(string iname,int iage)
    {
    name = iname;
    age = iage;
    }//end constructor
    void display()
    {
    cout

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

      Ur wrote display function wrongly..check once

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

    #include
    #include
    using namespace std;
    class human{
    public:
    string name="vinay sharma";
    friend void display();
    };
    void display(){
    cout

  • @ganeshkarthi1813
    @ganeshkarthi1813 9 років тому +1

    sir I have one doubt. In 18 & 22nd line u declare object name as man but in 30th line the object name is anil. I think "man" is an dummy argument Isn't or not.

    • @LearningLad
      @LearningLad  9 років тому +4

      ganesh karthi
      dude, in line 18 n 22 "man" is the function parameter name (which is of type human).
      anil is the object name in line 30.
      Here we are calling display() function and passing anil object as argument.
      inside display() function man will point to anil object.
      Hope this helps :)

    • @ganeshkarthi1813
      @ganeshkarthi1813 9 років тому +1

      *****
      thank u very much sir

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

    if we remove friend then we can use anil.display(anil) which will work.
    lol

  • @yougadhagupta8283
    @yougadhagupta8283 8 років тому +2

    #include
    #include
    using namespace std;
    class student{
    int id;
    int marks;
    public:
    student(int nid,int nmarks){
    id=nid;
    marks=nmarks;
    friend void display(student name);
    };
    void display(student name){
    cout

    • @LearningLad
      @LearningLad  8 років тому +3

      +Yougadha Gupta
      sorry for late reply.
      you are missing } for student constructor.
      #include
      #include
      using namespace std;
      class student{
      int id;
      int marks;
      public:
      student(int nid,int nmarks){
      id=nid;
      marks=nmarks;
      }
      friend void display(student name);
      };
      void display(student name){
      cout

    • @pranaytanniru7764
      @pranaytanniru7764 8 років тому

      cant yu even check out what the errors are.. ~-~

    • @dhyeyapandya1865
      @dhyeyapandya1865 7 років тому

      Well tried !