14 一个求点的类

来源:互联网 发布:软件设计方案 评审 编辑:程序博客网 时间:2024/05/20 04:49

#include <iostream.h>

class CPoint
{
public:
 CPoint(int intx,int inty)
 {
  x=intx;
  y=inty;
 }
 void display()
 {
  cout<<"X="<<x<<" Y="<<y<<endl;
 }
 void setpoint(int intx,int inty)
 {
  x=intx;
  y=inty;
 }
private:
 int x;
 int y;
};

void main()
{
 CPoint point(60,75);
 point.display();
 point.setpoint(80,150);
 point.display();

原创粉丝点击