Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Cl2;
- class Cl1
- {
- int x;
- public:
- Cl1(int a) :x(a) {}
- friend int sum(Cl1, Cl2);
- ~Cl1()
- {
- cout << "bebebbe";
- }
- };
- class Cl2
- {
- int y, z;
- friend int sum(Cl1, Cl2);
- public:
- Cl2(int b, int c) :y(b), z(c) {}
- ~Cl2()
- {
- cout << "huiiiii" << endl;
- }
- };
- int sum(Cl1 s, Cl2 f)
- {
- return s.x + f.y + f.z;
- }
- int main()
- {
- Cl1 m1(10);
- Cl2 m2(20, 30);
- cout << sum(m1, m2) << endl;//60
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment