实验1+类和对象.docVIP

  • 14
  • 0
  • 约1.69千字
  • 约 5页
  • 2017-07-08 发布于河南
  • 举报
实验1类和对象

洛阳理工学院实验报告 系别 计算机与信息工程系 班级 B110507 学号 姓名 课程名称 C++面向对象程序设计 实验日期 实验名称 类和对象 成绩 实验条件: Visual C++ 6.0软件 实验内容://test4-1.cpp #includeiostream using namespace std; class Coordinate { public: Coordinate(int x1,int y1) { x=x1; y=y1; } Coordinate(Coordinate p); ~Coordinate() { cout”Destructor is calleded\n”;} int getx() {return x;} int gety() {return y;} private: int x,y; }; Coordinate::Coordinate(Coordinate p) { x=p.x; y=p.y; cout”copy-initialization Constructou is called\n”; } int main() { Coordinate p1(3,4); Coordinate p2(p1); Coordinate p3=p2; cout”p3=(“p3.getx()”,”p3.g

文档评论(0)

1亿VIP精品文档

相关文档