friend Class in C++

SAMER SAEID answered on September 1, 2021 Popularity 9/10 Helpfulness 2/10

Contents


More Related Answers

  • c# friend class
  • use of friend function
  • c++ friend function operator overloading
  • 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++
  • C++ friend keyword
  • C++ friend keyword -2
  • friend Class in C++
  • friend class c++

  • friend Class in C++

    0
    Popularity 9/10 Helpfulness 2/10 Language cpp
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Jun 13 2022
    SAMER SAEID
    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 9/10 Helpfulness 2/10 Language cpp
    Source: Grepper
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Jun 13 2022
    SAMER SAEID
    0 Answers  Avg Quality 2/10

    5
    Popularity 10/10 Helpfulness 2/10 Language cpp
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Sep 01 2021
    Fierce Fish
    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 10/10 Helpfulness 2/10 Language cpp
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on May 19 2022
    Shahjahan Ansari
    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

    0
    Popularity 9/10 Helpfulness 1/10 Language cpp
    Source: Grepper
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Jun 13 2022
    SAMER SAEID
    0 Answers  Avg Quality 2/10

    0
    Popularity 9/10 Helpfulness 1/10 Language cpp
    Source: Grepper
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Jun 13 2022
    SAMER SAEID
    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.