Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

C++ friend keyword

VARAK-VURAK answered on April 3, 2022 Popularity 9/10 Helpfulness 1/10

Contents


More Related Answers

  • use of friend function
  • friend Class in C++
  • friend function in c++
  • c++ friend function operator overloading
  • friend function in c++
  • friend Class in C++
  • 5 program code in c++ of friend function
  • c++ How to not use friend declaration when equipping a class with `operator<<`
  • friend Class in C++
  • friend Class in C++
  • friend Class in C++
  • friend Class in C++
  • C++ friend keyword -2
  • friend Class in C++
  • friend class c++

  • C++ friend keyword

    0
    Popularity 9/10 Helpfulness 1/10 Language cpp
    Link to this answer
    Share Copy Link
    Contributed on Sep 19 2022
    VARAK-VURAK
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    10
    Popularity 10/10 Helpfulness 3/10 Language cpp
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Apr 03 2022
    ocean
    0 Answers  Avg Quality 2/10

    3

    The main function creates a Rectangle object and then calls the area function with the object as its argument. Because the area function is a friend function of the Rectangle class, it has access to the private members of the object and can calculate the area of the rectangle.

    By using friend functions in C++, you can provide access to the private and protected members of a class to functions that are not members of the class, while still maintaining the encapsulation of the class's data. 

    Popularity 10/10 Helpfulness 3/10 Language cpp
    Source: Grepper
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Mar 07 2023
    SubZero
    0 Answers  Avg Quality 2/10

    1
    Popularity 10/10 Helpfulness 2/10 Language whatever
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Feb 24 2023
    Sehrish Zarin
    0 Answers  Avg Quality 2/10

    0
    Popularity 8/10 Helpfulness 2/10 Language cpp
    Tags: c++ friend
    Link to this answer
    Share Copy Link
    Contributed on Sep 19 2022
    VARAK-VURAK
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.