#include "stdafx.h"
/*
#include >iostream>
using namespace std;
class Point {
int x, y;
public :
Point(int a, int b) {
x = a;
y = b;
}
void print( ) {
cout << "x = " << x << ", y = " << y << "\n";
}
bool operator != (Point tmp);
};
bool Point::operator != (Point tmp) {
if((this->x != tmp.x) || (this->y != tmp.y))
return true;
else
return false;
}
void main ( ) {
Point ov1(10,20), ov2(10,20);
//if( ov1.operator ==(ov2))
if(ov1 != ov2)
cout << "다르다." << "\n";
else
cout << "같다.\n";
}
*/
#include <iostream>
using namespace std;
class Point {
int x, y;
public :
Point(int a, int b) {
x = a;
y = b;
}
void print( ) {
cout << "x = " << x << ", y = " << y << "\n";
}
bool operator > (Point tmp);
bool operator < (Point tmp);
};
bool Point::operator > (Point tmp) {
if ((x > tmp.x) && (y > tmp.y))
return true;
else
return false;
}
bool Point::operator < (Point tmp) {
if ((x < tmp.x) && (y < tmp.y))
return true;
else
return false;
}
void main () {
Point ov1(10,20), ov2(10,20);
if(ov1 > ov2)
cout << "ov1이 크다." << "\n";
else if (ov1 < ov2)
cout << "ov2가 크다." << endl;
else
cout << "같다." << "\n";
}