Created
April 23, 2017 17:41
-
-
Save patelmilanun/7851ab44731c30c516c4fa324430607e 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 B; | |
class A { | |
private: | |
int x; | |
public: | |
A() | |
{ | |
x=10; | |
} | |
friend int sub(A, B); | |
}; | |
class B { | |
private: | |
int y; | |
public: | |
B() | |
{ | |
y=2; | |
} | |
friend int sub(A , B); | |
}; | |
int sub(A objectA, B objectB) | |
{ | |
return (objectA.x - objectB.y); | |
} | |
int main() | |
{ | |
A objectA; | |
B objectB; | |
cout<<"Substraction: "<< sub(objectA, objectB); | |
return 0; | |
} | |
================================output============================ | |
Substraction: 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment