Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class B;
- class A
- {
- private:
- int hight;
- public:
- A();
- friend int sum(A,B);
- };
- class B
- {
- private:
- int hight2;
- public:
- B();
- friend int sum(A,B);
- };
- A::A()
- {
- hight = 10;
- }
- B::B()
- {
- hight2 = 20;
- }
- int sum (A a, B b)
- {
- return (a.hight+b.hight2);
- }
- int main ()
- {
- A a;
- B b;
- cout << sum(a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment