#include

using namespace std;



class Point {

private:

int x;

int y;

public:

bool InitMembersPoint(int xpos, int ypos);

int GetX() const;

int GetY() const;

bool SetX(int xpos);

bool SetY(int ypos);

};


bool Point::InitMembersPoint(int xpos, int ypos) {

if (0 > xpos || xpos > 100 || 0 > ypos || ypos > 100) {

cout << "벗어난 범위의 값 전달" <

return false;

}

x = xpos;

y = ypos;

return true;

}

int Point::GetX() const {

return Point::x;

}

int Point::GetY() const {

return Point::y;

}

bool Point::SetX(int xpos) {

if (0 > xpos || xpos > 100) {

cout << "벗어난 범위의 값 전달" <

return false;

}

x = xpos;

return true;

}

bool Point::SetY(int ypos) {

if (0 > ypos || ypos > 100) {

cout << "벗어난 범위의 값 전달" <

return false;

}

y = ypos;

return true;

}


------------ 위에가 Point.cpp



#include "Point.cpp"



class Rectangle {

private:

Point upLeft;

Point lowRight;

public:

bool InitMembers(const Point& ul, const Point& lr);

void ShowRecInfo() const;

};


bool Rectangle::InitMembers(const Point& ul, const Point& lr) {

if (ul.GetX() > lr.GetX() || ul.GetY() > lr.GetY()) {

cout << "잘못된 위치정보 전달" <

return false;

}

upLeft = ul;

lowRight = lr;

return true;

}


void Rectangle::ShowRecInfo() const {

cout << "Up Left: " <

cout << "lowRight: " <

}


--------------- 이게 Rectangle.cpp 인데 Point.cpp를 호출해야함



#include "Rectangle.cpp"


int main(void) {

Point p1, p2;

p1.InitMembersPoint(3, 5);

p2.InitMembersPoint(5, 11);


Rectangle rec;

rec.InitMembers(p1, p2);

rec.ShowRecInfo();


return 0;

}


이게 main함수가 있는 cpp.


cpp 이름같은건 다 정해진 과제대로 쓴거임