Created
April 19, 2018 11:05
-
-
Save emirozturk/a6d18552393d9c4cfe3f315b0fa33754 to your computer and use it in GitHub Desktop.
Friend Classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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