fig5_7.cpp

来自「用三个类来研究类的继承!类Point、Circle、Cylinder」· C++ 代码 · 共 20 行

CPP
20
字号
//fig5_7.cpp
//类Point的测试程序

#include <iostream.h>
#include <assert.h>
#include "point2.h"

main()
{
	Point p(7.2, 11.5);	//建立类Point的对象实例

	//main函数不能访问类Point的受保护数据成员
	cout<<"X coodinate is "<<p.getX()
		<<"\nY coodinate is "<<p.getY()<<endl;

	p.setPoint(10, 10);
	cout<<"\nThe new location of p is "<<p<<endl;

	return 0;
}

⌨️ 快捷键说明

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