pnt.cpp

来自「这是书上的代码」· C++ 代码 · 共 56 行

CPP
56
字号
// Pnt.cpp: implementation of the CPnt class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "const.h"
#include "paintobj.h"
#include "Pnt.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//IMPLEMENT_DYNAMIC(CPnt, CObject)

CPnt::~CPnt()
{

}

CArchive& operator >> (CArchive& ar, CPnt& Obj)
{
	ar >> Obj.x >> Obj.y;
	return ar;
}

CArchive& operator << (CArchive& ar, CPnt& Obj)
{
	ar << Obj.x << Obj.y;
	return ar;
}

void CPnt::operator =(CPnt pnt)
{
	x=pnt.x;
	y=pnt.y;
}

//
//   overloaded operator ==: Test if 2 objects are identical.
//
BOOL CPnt::operator ==(CPnt& pt)
{
	return (x == pt.x && y == pt.y);
}





⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?