分享

POINT和CPoint有甚么区别!?-实例分析-华软网

 chensirDSP 2010-05-02
C/C++ code
//POINT是个简单的结构
typedef struct tagPOINT
{
    LONG  x;
    LONG  y;
} POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;
//CPoint类复杂一些
class CPoint : public tagPOINT
{
public:
// Constructors
    // create an uninitialized point
    CPoint();
    // create from two integers
    CPoint(int initX, int initY);
    // create from another point
    CPoint(POINT initPt);
    // create from a size
    CPoint(SIZE inITSize);
    // create from a dword: x = LOWORD(dw) y = HIWORD(dw)
    CPoint(DWORD dwPoint);
// Operations
// translate the point
    void Offset(int xOffset, int yOffset);
    void Offset(POINT point);
    void Offset(SIZE size);
    BOOL operator==(POINT point) const;
    BOOL operator!=(POINT point) const;
    void operator+=(SIZE size);
    void operator-=(SIZE size);
    void operator+=(POINT point);
    void operator-=(POINT point);
// Operators returning CPoint values
    CPoint operator+(SIZE size) const;
    CPoint operator-(SIZE size) const;
    CPoint operator-() const;
    CPoint operator+(POINT point) const;
// Operators returning CSize values
    CSize operator-(POINT point) const;
// Operators returning CRect values
    CRect operator+(const RECT* lpRect) const;
    CRect operator-(const RECT* lpRect) const;
};
    .
编程论坛 5 个网友回答: MSDN上都有。    .
编程论坛 6 个网友回答: Point 是个结构

C/C++ code
typedef struct tagPOINT
{
    LONG  x;
    LONG  y;
} POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;

CPoint 是封装的一个类

C/C++ code
class CPoint : public tagPOINT
{
…………
}

欢迎转载,但请保留出处,本文章转自[华软网] 原文链接:http://www./program/vc/vc02/200907/1714885.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多