当前位置: 首页 > news >正文

代刷网站系统怎么做手机怎么用wordpress

代刷网站系统怎么做,手机怎么用wordpress,电商网站是怎么建设的,特种证书查询入口Item32 确定你的public继承关系建模出is-a的关系 public继承的含义#xff1a; is-a#xff1a;student是一种person#xff0c;person的范围更大在函数传参的过程#xff0c;eta能同时接受person和student两种变量#xff0c;反之不能 class Person {}; class Student…Item32 确定你的public继承关系建模出is-a的关系 public继承的含义 is-astudent是一种personperson的范围更大在函数传参的过程eta能同时接受person和student两种变量反之不能 class Person {}; class Student : public Person {};void eta(const Person p) {} void study(const Student s) {}int main() {Person p;Student s;eta(p);eta(s);study(s);study(p);return 0; }/** 报错信息 main.cpp:11:11: error: invalid initialization of reference of type ‘const Student’ from expression of type ‘Person’11 | study(p);| ^ In file included from main.cpp:3: item_32.h:14:27: note: in passing argument 1 of ‘void study(const Student)’14 | void study(const Student s) {} */ 通过public继承建模应该慎重思考父类和子类的关系考虑下面两个例子 企鹅是一种鸟但是不会飞建模方式1不太恰当如果方式2不需要区分会飞和不会飞建模2显得多余方式3将编译器能够限制的错误推迟到了运行期同样不恰当方式4不定义这样的方法如果子类觉得有必要在定义有更广的应用范围 // 建模方式1 class Bird { public:virtual void fly() {} }; class Penguin : public Bird {};// 建模方式2 class Bird {}; class FlyingBird : public Bird { public:virtual void fly() {} }; class Penguin : public Bird {};// 建模方式3 class Bird { public:virtual void fly() {} }; class Penguin : public Bird { public:virtual void fly() { error(); } };// 建模方式4 class Bird {}; class Penguin : public Bird {}; 如果是正方形继承自长方形可以看出结果不符合预期 class Rectangle { public:virtual void setHeight(int newHeight);virtual void setWidth(int newWidth);virtual int height() const;virtual int width() const; }; class Square : public Rectangle {}; void makeBigger(Rectangle r) {int oldHeight r.height();r.setHeight(r.width() 10);assert(r.height() oldHeight); }Square s; makeBigger(s); // 结果不符合预期
http://www.pierceye.com/news/531743/

相关文章:

  • 网上做物理题赚钱的网站肥城住房和城乡建设局网站
  • 傻瓜式网站源码比较好的网站建设品牌升级
  • 买东西的网站德阳机械加工网
  • 企业网站建设的基本标准是广告公司运作模式
  • 做推广网站的文章电动汽车排名前十名
  • 宜州网站建设服务网页生成长图 iphone
  • 网站关键词seo费用广告设计教学大纲
  • 网站开发视频 百度云自己做网站卖东西
  • 二级网站建设费用品牌广告投放
  • 西宁做网站君博认同门户网站建设实施方案
  • 外贸公司做网站该去哪里找萝岗手机网站建设
  • 网站建设的商业目的惠州网站建设培训
  • 一个网站备案多个域名吗中国建设工程信息网官网入口
  • 广告网站设计哪家快做网站一般注册哪几类商标
  • 学网站建设有前途吗网站对话窗口怎么做
  • 云南昆明做网站wordpress备份文件
  • 连云港市网站建设汕头制作手机网站
  • 印度做网站wordpress 锁定地址
  • 做网站的服务器带宽一般多少游戏开发培训机构
  • 网站设计制作培训微信开放平台文档
  • 私人申请建设网站多少钱html如何建网站
  • 网站怎么在微博推广石家庄模板建站平台
  • 贵阳网站开发方舟网络wordpress静态化链接
  • 如何建设一个公司网站英文网站建设多少钱
  • 国外做水广告网站大全app开发公司查询
  • 苏州商城网站制作免费下载ppt模板的网站有哪些
  • 北京智能网站建设企业wordpress 找源码
  • 无锡网站维护公司wordpress 目录排序
  • 自己搭建的ftp怎么做网站装修公司展厅效果图
  • 做网站手机验证收费吗百度竞价推广是什么工作