Search
 
SCRIPT & CODE EXAMPLE
 

CPP

5 program code in c++ of friend function

#include <iostream>
 
class A {
    int a;
 
public:
    A() { a = 0; }
 
    // global friend function
    friend void showA(A&);
};
 
void showA(A& x)
{
    // Since showA() is a friend, it can access
    // private members of A
    std::cout << "A::a=" << x.a;
}
 
int main()
{
    A a;
    showA(a);
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: Normal Initialisation of 3D Vector 
Cpp :: choose endianness in cpp 
Cpp :: deadlock detection in c++coding ninjas 
Cpp :: c++ format number thousands separator 
Cpp :: add nested vector cpp 
Cpp :: 1281. Subtract the Product and Sum of Digits of an Integer leetcode solution in c++ 
Cpp :: C++ concept simple requirements 
Cpp :: vprintf 
Cpp :: how to use and in c++ 
Cpp :: Check if two stacks are the same using C++ 
Cpp :: simple interest rate 
Cpp :: cicli informatica c++ 
Cpp :: c++ const shared_ptr 
Cpp :: convert ros time to double 
Cpp :: online compiler cpp 
Cpp :: c++ string to vector int 
Cpp :: c++ array on heap 
Cpp :: how to tokenize a string in c++ 
Cpp :: c++ quicksort 
Cpp :: can derived class access private members 
Cpp :: a function to create double quotes for alphabet in c++ 
C :: C output color font 
C :: plt hide axis ticks 
C :: haskell print 
C :: c code to python code converter online 
C :: binary search in c 
C :: add 2 numbers in c 
C :: c round function 
C :: svg not loading in chrome 
C :: c read csv 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =