Files
ooplab/lab4/12.cpp
Amneesh Singh ad185c994e labs 1-6: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-24 14:03:08 +05:30

34 lines
411 B
C++

#include <algorithm>
#include <iostream>
using namespace std;
class Foo;
class Bar;
class Foo {
private:
int foo;
public:
Foo(int n) { foo = n; }
friend int bigger(Foo, Bar);
};
class Bar {
private:
int bar;
public:
Bar(int n) { bar = n; }
friend int bigger(Foo, Bar);
};
int bigger(Foo a, Bar b) { return max(a.foo, b.bar); }
int main() {
Foo a(5);
Bar b(55);
cout << bigger(a, b);
}