Created
April 23, 2017 16:50
-
-
Save patelmilanun/b7f1377773698f8dd347d132f3e90230 to your computer and use it in GitHub Desktop.
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 N; | |
class M { | |
private: | |
int x; | |
public: | |
M() | |
{ | |
x=10; | |
} | |
friend int div(M, N); | |
}; | |
class N { | |
private: | |
int y; | |
public: | |
N() | |
{ | |
y=2; | |
} | |
friend int div(M , N); | |
}; | |
int div(M objectA, N objectB) | |
{ | |
return (objectA.x / objectB.y); | |
} | |
int main() | |
{ | |
M objectA; | |
N objectB; | |
cout<<"Div: "<< div(objectA, objectB); | |
return 0; | |
} | |
========================output========================== | |
Div: 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment