Skip to content

Instantly share code, notes, and snippets.

@patelmilanun
Created April 23, 2017 16:50
Show Gist options
  • Save patelmilanun/b7f1377773698f8dd347d132f3e90230 to your computer and use it in GitHub Desktop.
Save patelmilanun/b7f1377773698f8dd347d132f3e90230 to your computer and use it in GitHub Desktop.
#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