- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
1、//cow.h#ifndef COW_H_#define COW_H_#includeiostream#includestring#includestdio.husing namespace std;class Cow{private:char name[20];char *hobby;double weight;public:Cow();Cow(const char *nm, const char *ho, double wt);Cow(const Cow c);~Cow();Cow operator=(const Cow c);voidShowCow()const;};#endif//cow.cpp#includecow.hCow::Cow(){name[0] = \0;hobby = new char[1];hobby[0] = \0;weight = 0;}Cow::Cow(const char *nm, const char *ho, double wt){strcpy_s(name, 20, nm);hobby = new char[strlen(ho)+1];strcpy_s(hobby, strlen(ho) + 1, ho);weight = wt;}Cow::Cow(const Cow c){strcpy_s(name, 20, );hobby = new char[strlen(c.hobby) + 1];strcpy_s(hobby, strlen(c.hobby) + 1, c.hobby);weight = c.weight;}Cow::~Cow(){delete[]hobby;}Cow Cow::operator=(const Cow c){if (this == c)return *this;delete[]hobby;hobby = new char[strlen(c.hobby) + 1];strcpy_s(hobby, strlen(c.hobby) + 1, c.hobby);strcpy_s(name, 20, );weight = c.weight;return *this;}void Cow::ShowCow()const{cout Cow name: name endl;cout Cow hobby: hobby endl;cout Cow weight: weight endl;}//main.cpp#includecow.hint main(){Cow co1;Cow co2(cow1, sport, 123);Cow co3(co2);co1 = co2;co1.ShowCow();co2.ShowCow();co3.ShowCow();system(pause);return 0;}2、//String.h#ifndef STRING_H_#define STRING_H_#include iostream#include stdio.h#include cstring#include string.husing namespace std;class String{public:String(const char *s);String();String(const String );~String();int length()const { return len; }String operator=(const String st);String operator=(const char *);char operator[](inti);const char operator[](inti)const;voidstringlow();voidstringup();int has(const char ch);String operator+(const char *s);friend String operator+(const char *s, const String st);friendbool operator(const String st1, const String st2);friendbool operator(const String st1, const String st2);friendbool operator==(const String st1, const String st2);friend String operator+(const String st1, const String st2);friendostream operator(ostream os, const String st);frie
您可能关注的文档
- CString工作原理.docx
- 【医学英语】中医术语3.docx
- 日语50基础音节.docx
- errpt 查看错误日志.docx
- 经营指标核算方法.docx
- 2013年完美世界校园招聘笔试题.docx
- 关于10人龙母攻略几个关键点.docx
- LED照明 灯具 英语 单词.docx
- 单片机C语言笔记.docx
- js常用正则表达式表单验证代码(最全面).docx
- “两个加强、两个遏制”回头看专项测试题 (2).docx
- 郑州大学第一届程序设计大赛试题.docx
- 工程施工标准规范参考.docx
- 用户管理useradd,passwd,chage,usermod,userdel.docx
- 二、三层EtherChannel技术实现方法.docx
- linux下tomcat优化,设置最大连接数,内存,Jconsole监控.docx
- matlab简单命令.docx
- 总感觉有点不对,你也这么觉得?好,这么觉得你就赢了一半了!.doc
- 别在天亮之前离开我.docx
- 【摘】在英国申根国家签证信息(France,Italy,Holand,Belgium,Greece,Spain,Germany).docx
最近下载
- 移动L1认证传输专业试题汇总(含答案).pdf VIP
- (新版)中移动传输专业L1认证考试复习题库-上(单选题汇总).docx VIP
- 计算机专业(基础综合)模拟试卷3(共456题).pdf VIP
- 项目编号szcg2007041645 项目名称2007年度深圳市储备土地管理.doc
- 离婚登记申请受理回执单民法典版(可直接打印).pdf VIP
- 人教五年级数学上册1.2.2 倍数是小数的实际问题和乘法验算 课时训练.doc VIP
- 光伏电站检修规程(行业标准).docx VIP
- (新版)中移动传输专业L1认证考试复习题库-下(多选题汇总).docx VIP
- 基于大概念的初中音乐单元整体教学设计探索.doc VIP
- 《企业经营数据分析》课件.ppt VIP
文档评论(0)