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

企业网站建立要做的准备网络推广项目代理

企业网站建立要做的准备,网络推广项目代理,wordpress设置静态页面,大学生旅游网站策划书思维导图#xff1a; 2试编程 封装一个动物的基类#xff0c;类中有私有成员: 姓名#xff0c;颜色#xff0c;指针成员年纪 再封装一个狗这样类#xff0c;共有继承于动物类#xff0c;自己拓展的私有成员有:指针成员:腿的个数(整型 int count)#xff0c;共有成员函数…思维导图 2试编程 封装一个动物的基类类中有私有成员: 姓名颜色指针成员年纪 再封装一个狗这样类共有继承于动物类自己拓展的私有成员有:指针成员:腿的个数(整型 int count)共有成员函数会叫: void speak() 要求:分别完成基类和派生类中的:构造函数、析构函数、拷贝构造函数、拷贝赋值函数 eg Dog d1; Dog d2(.....); Dog d3(d2); d1 d3, #include iostreamusing namespace std;class Animal { private:string name;string color;int *age; protected:public:Animal(){cout Animal::无参构造函数 endl;}Animal(string name,string color,int age):name(name),color(color),age(new int(age)){cout Animal::有参构造函数 endl;}~Animal(){cout Animal::析构函数 endl;delete age;}Animal(const Animal other):name(other.name),color(other.color),age(new int(*other.age)){cout Animal::拷贝构造函数 endl;}Animal operator(const Animal other){if(this ! other){name other.name;color other.color;age new int(*other.age);}cout Animal::拷贝赋值函数 endl;return *this;}void show(){cout name color *age ;} }; class Dog:public Animal { private:int *count; public:void speak(){cout 汪汪汪~ endl;}Dog(){cout Dog::无参构造函数 endl;}Dog(string name,string color,int age,int count):Animal(name,color,age),count(new int(count)){cout Dog::有参构造函数 endl;}~Dog(){cout Dog::析构函数 endl;delete count;}Dog(const Dog other):Animal(other),count(new int(*other.count)){cout Dog::拷贝构造函数 endl;}Dog operator(const Dog other){if(this ! other){Animal::operator(other);count new int(*other.count);}cout Dog::拷贝赋值函数 endl;return *this;}void show(){Animal::show();cout *count endl;} }; int main() {Dog d1;Dog d2(小黑,黑色,5,4);d2.show();Dog d3(d2);d3.show();d1d3;d1.show();return 0; }运行结果 3.编程题 以下是一个简单的比喻将多态概念与生活中的实际情况相联系: 比喻:动物园的讲解员和动物表演 想象一下你去了一家动物园看到了许多不同种类的动物如狮子、大象、猴子等。现在动物园里有一位讲解员他会为每种动物表演做简单的介绍。 在这个场景中我们可以将动物比作是不同的类而每种动物表演则是类中的函数。而讲解员则是一个基类他可以根据每种动物 的特点和表演进行相应的介绍。 具体过程如下 定义一个基类Animal其中有一个虚函数perform ()用于在子类中实现不同的表演行为  #include iostreamusing namespace std;class Animal { private:string name;string color;int *age; protected:public:Animal(){cout Animal::无参构造函数 endl;}Animal(string name,string color,int age):name(name),color(color),age(new int(age)){cout Animal::有参构造函数 endl;}~Animal(){cout Animal::析构函数 endl;delete age;}Animal(const Animal other):name(other.name),color(other.color),age(new int(*other.age)){cout Animal::拷贝构造函数 endl;}Animal operator(const Animal other){if(this ! other){name other.name;color other.color;age new int(*other.age);}cout Animal::拷贝赋值函数 endl;return *this;}virtual void perform() 0;void show(){cout name color *age ;} }; class Elephant:public Animal { private:int *count; public:void perform(){cout 喷水 吃香蕉 endl;}Elephant(){cout Elephant::无参构造函数 endl;}Elephant(string name,string color,int age,int count):Animal(name,color,age),count(new int(count)){cout Elephant::有参构造函数 endl;}~Elephant(){cout Elephant::析构函数 endl;delete count;}Elephant(const Elephant other):Animal(other),count(new int(*other.count)){cout Elephant::拷贝构造函数 endl;}Elephant operator(const Elephant other){if(this ! other){Animal::operator(other);count new int(*other.count);}cout Dog::拷贝赋值函数 endl;return *this;}void show(){Animal::show();cout *count endl;} }; class Lion:public Animal { private:int *count; public:void perform(){cout 钻火圈 endl;}Lion(){cout Lion::无参构造函数 endl;}Lion(string name,string color,int age,int count):Animal(name,color,age),count(new int(count)){cout Lion::有参构造函数 endl;}~Lion(){cout Lion::析构函数 endl;delete count;}Lion(const Lion other):Animal(other),count(new int(*other.count)){cout Lion::拷贝构造函数 endl;}Lion operator(const Lion other){if(this ! other){Animal::operator(other);count new int(*other.count);}cout Dog::拷贝赋值函数 endl;return *this;}void show(){Animal::show();cout *count endl;} }; int main() {Elephant e1(大象,五彩,6,4);Lion l1(狮子,棕黄色,4,4);e1.perform();l1.perform();return 0; }
http://www.pierceye.com/news/57581/

相关文章:

  • 简单的网站类型有哪些内容朝阳网站搭建公司
  • 江西建设银行官方网站升级的网站显示什么
  • 简述建设一个网站的具体步骤版面设计的目的是什么
  • 网站布局设计步骤万载网站建设
  • 网页设计与制作教案详案长沙优化科技有限公司电话
  • 网站建设开发价格中国住房和城乡建设部网站证书查询
  • 洛阳网站优化网站建设收入
  • 苏州网站优化推广wordpress安装完不显示不出来
  • 免费的行情网站ifind是做的网站加载太慢怎么办
  • 怎么验证网站备案密码是否正确网页设计的能干什么职位
  • 旅游网站html民宿设计网站大全
  • 个体户营业执照科研做企业网站吗网站 运营工作如何做
  • 开发网站wordpress图片主题破解
  • 显示网站翻页代码成都网站建设是什么
  • 深圳罗湖建网站银行虚拟网站制作
  • 做网站客户要提供什么网站内容优化怎么去优化呢
  • 怎样在百度上建网站做企业网站的尺寸是多少
  • 河南省建设教育协会网站黑龙江住房和城乡建设厅网站
  • 资源软件下载网站免费百度快照手机版网页版
  • 建设企业管理类网站白酒营销网站
  • 网站建设需求说明免费隐私网站推广
  • 重庆免费注册推广网站微信网站建设公司首选
  • 用vs做音乐网站医疗保健网站前置审批文件
  • 扬州建设公司网站关于做花茶网站的策划书
  • 网址注册了怎么做网站aisinoty810色带
  • 学做窗帘要下载哪个网站网站建设所需人员
  • 在一个网站上面发布广告怎么做c2c网站的主要功能
  • 两学一做网站安徽省怎么自己做游戏软件
  • 手机什么网站可以设计楼房网站销售怎么做
  • 网站开发专业职称有哪些精美wordpress模板