Skip to content

Instantly share code, notes, and snippets.

@emirozturk
Created April 19, 2018 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emirozturk/a6d18552393d9c4cfe3f315b0fa33754 to your computer and use it in GitHub Desktop.
Save emirozturk/a6d18552393d9c4cfe3f315b0fa33754 to your computer and use it in GitHub Desktop.
Friend Classes
#include <iostream>
using namespace std;
class A;
class B{
public:
void oku(A& a);
void yaz(A& a);
};
class A{
private:
int degisken;
public:
void method(){
cout << degisken << endl;
}
friend void B::oku(A& a);
friend void erisim(A& a);
};
void B::oku(A &a){
cout << a.degisken << endl;
}
void erisim(A& a){
cout << a.degisken << endl;
}
int main(){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment