33
lab4/12.cpp
Normal file
33
lab4/12.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#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);
|
||||
}
|
Reference in New Issue
Block a user