point2.cpp
来自「用三个类来研究类的继承!类Point、Circle、Cylinder」· C++ 代码 · 共 28 行
CPP
28 行
//point2.cpp
//类Point的成员函数定义
#include <iostream.h>
#include <assert.h>
#include "point2.h"
//构造函数
Point:: Point(float a, float b)
{
x=a;
y=b;
}
//设在x和y的坐标值
void Point:: setPoint(float a, float b)
{
x=a;
y=b;
}
//输出点的坐标
ostream &operator<< (ostream &output, const Point &p)
{
output<<"["<<p.x<<", "<<p.y<<"]";
return output; //使得能够连续输出
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?