2014210723李玉花实验报告五类与对象.docVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2014210723李玉花实验报告五类与对象

宁夏师范学院数学与计算机科学学院 《》实验报告 实验序号:          实验项目名称:学  号 姓  名 专业班实验地点 指导教师 时间 一、实验目的及要求 4、正确理解对象的赋值及对象的复制,掌握对象的赋值及复制方法; 5、继续学习使用VC6.0的Debug调试功能,观察程序流程,跟踪观察类的构造函数、析构函数、成员函数的执行顺序 二、实验设备(环境)及要求 硬件:PC(PII以上,128M以上内存)、因特网接入; 软件:Windows XP操作系统、Office2003、。2学时 其他要求:对实验例题和例题操作步骤进行阅读,并实现;验证题目和设计题目尽量完成;任选一个设计题目写实验报告 三、实验内容与步骤】#includeiostream using namespace std; class Box { public: Box(int,int,int); int volume(); private: int height; int width; int length; }; Box::Box(int h,int w,int len) { height=h; width=w; length=len; } int Box::volume() { return(height*length*width); } int main() { Box box1(12,25,30); coutThe volume of box1 isbox1.volume()endl; Box box2(15,30,21); coutThe volume of box2 isbox2.volume()endl; return 0; } 运行结果: 9.3 #includeiostream using namespace std; class Box { public: Box(); Box(int h,int w,int len):height(h),width(w),length(len) {} int volume(); private: int height; int width; int length; }; Box::Box() { height=10; width=10; length=10; } int Box::volume() { return(height*width*length); } int main() { Box box1; coutThe volume of box1 isbox1.volume()endl; Box box2; coutThe volume of box2 isbox2.volume()endl; return 0; } 9.4 #includeiostream using namespace std; class Box { public: Box(int h=10,int w=10,int len=10); int volume(); private: int height; int width; int length; }; Box::Box(int h,int w,int len) { height=h; width=w; length=len; } int Box::volume() { return(height*width*length); } int main() { Box box1; coutThe volume of box1 is box1.volume()endl; Box box2(15); coutThe volume of box2 is box2.volume()endl; Box box3(15,30); coutThe volume of box3 is box3.volume()endl; Box box4(15,30,20); coutThe volume of box4 is box4.volume()endl; return 0; } 9.5 #includestring #includeiostream using namespace std; class Student { public: Student(int n,string nam,char s) { num=n; name=nam; sex=s; coutConstructor called.endl; } ~Student() { coutDestructor called.endl; } void display() { coutnu

文档评论(0)

haihang2017 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档