Created
April 19, 2018 11:06
-
-
Save emirozturk/09fe9144754a01d06c780d489de4b692 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 Uzaklik | |
{ | |
private: | |
int m; | |
public: | |
Uzaklik() : m(0) { } | |
friend int ekle(Uzaklik u, int miktar); | |
}; | |
int ekle(Uzaklik u, int miktar) | |
{ | |
u.m += miktar; | |
return u.m; | |
} | |
int main() | |
{ | |
Uzaklik u; | |
cout << "Distance: " << ekle(u,5); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment