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

为什么做美妆网站大数据查询个人信息

为什么做美妆网站,大数据查询个人信息,杭州点餐app开发,世界经理人网站手机版编程1: 封装一个动物的基类,类中有私有成员:姓名,颜色,指针成员年纪 再封装一个狗这样类,共有继承于动物类,自己拓展的私有成员有:指针成员:腿的个数(整型 …

编程1:

封装一个动物的基类,类中有私有成员:姓名,颜色,指针成员年纪

再封装一个狗这样类,共有继承于动物类,自己拓展的私有成员有:指针成员:腿的个数(整型 int count),共有成员函数:会叫:void speak()

要求:分别完成基类和派生类中的:构造函数、析构函数、拷贝构造函数、拷贝赋值函数

#include <iostream>using namespace std;//封装 动物 类  -->基类
class Animal
{
private:string name;string colour;int *age;
public:Animal(){}Animal(string name,string colour,int age):name(name),colour(colour),age(new int(age)){cout << "基类::有参构造函数" << endl;}Animal(const Animal &other):name(other.name),colour(other.colour),age(new int(*other.age)){cout << "基类::拷贝构造函数" << endl;}Animal &operator=(const Animal &other){if(this != &other){name = other.name;colour = other.colour;age = new int(*other.age);}cout << "基类::拷贝赋值函数" << endl;return *this;}~Animal(){delete age;age = nullptr;cout << "基类::析构函数"  <<  endl;}
};//封装  狗  类  public 继承 动物 类   --> 派生类
class Dog:public Animal
{
private:int *number;  //腿的个数
public:Dog() {}Dog(string name,string colour,int age,int number):Animal(name,colour,age),number(new int(number)){cout << "派生类::有参构造函数" << endl;}Dog(const Dog &other):Animal(other),number(new int(*other.number)){cout << "派生类::拷贝构造函数" << endl;}Dog &operator=(const Dog &other){if(this != &other){Animal::operator=(other);number = new int(*other.number);}cout << "派生类::拷贝赋值函数" << endl;return *this;}void speak(){cout <<  "汪!汪!汪!" << endl;}~Dog(){delete number;number = nullptr;cout << "派生类::析构函数"  <<  endl;}
};int main()
{Dog d1("旺财","黑色",3,4);d1.speak();Dog d2 = d1;Dog d3;d3 = d1;return 0;
}

 

编程2:

以下是一个简单的比喻,将多态概念与生活中的实际情况相联系:

比喻:动物园的讲解员和动物表演

想象一下你去了一家动物园,看到了许多不同种类的动物,如狮子、大象、猴子等。现在,动物园里有一位讲解员,他会为每种动物表演做简单的介绍。

在这个场景中,我们可以将动物比作是不同的类,而每种动物表演则是类中的函数。而讲解员则是一个基类,他可以根据每种动物的特点和表演,进行相应的介绍。

具体过程如下:

定义一个基类 Animal,其中有一个虛函数perform(),用于在子类中实现不同的表演行为。

#include <iostream>using namespace std;//封装 讲解员  基类
class Commentator
{
public:virtual void perform() = 0;   //纯虚函数virtual ~Commentator(){}   //虚解析函数
};//封装  Lion 派生类
class Lion : public Commentator
{
public:void perform()      // 重写 perform 函数{cout << "狮子正在睡觉" << endl;}
};//封装 Elephant 派生类
class Elephant : public Commentator
{
public:void perform()   // 重写 perform 函数{cout << "大象正在吃香蕉" << endl;}
};//封装 Monkey 派生类
class Monkey : public Commentator
{
public:void perform()      // 重写 perform 函数{cout << "猴子正在爬树" << endl;}
};int main()
{Commentator *p1 = new Lion;     //基类的指针指向派生类LionCommentator *p2 = new Elephant; //基类的指针指向派生类ElephantCommentator *p3 = new Monkey;   //基类的指针指向派生类Monkeyp1->perform(); p2->perform(); p3->perform();   //通过父类指针调用基类中的重写函数delete  p1;  delete  p2;  delete  p3;delete  p1;  delete  p2;   delete  p3;return 0;
}

思维导图


文章转载自:
http://limmasol.c7510.cn
http://dispraise.c7510.cn
http://cheapshit.c7510.cn
http://pcmcia.c7510.cn
http://overwrap.c7510.cn
http://anaclitic.c7510.cn
http://flavourful.c7510.cn
http://idleness.c7510.cn
http://silvering.c7510.cn
http://miler.c7510.cn
http://compadre.c7510.cn
http://stonily.c7510.cn
http://gainable.c7510.cn
http://trisomy.c7510.cn
http://scantling.c7510.cn
http://carsey.c7510.cn
http://zazen.c7510.cn
http://unripe.c7510.cn
http://techy.c7510.cn
http://liveried.c7510.cn
http://overhear.c7510.cn
http://bpd.c7510.cn
http://vainly.c7510.cn
http://phytoclimatology.c7510.cn
http://proposal.c7510.cn
http://blousy.c7510.cn
http://quintan.c7510.cn
http://disgregate.c7510.cn
http://eightpenny.c7510.cn
http://mandrill.c7510.cn
http://hateless.c7510.cn
http://reins.c7510.cn
http://donjon.c7510.cn
http://theriomorphous.c7510.cn
http://medley.c7510.cn
http://hypothecate.c7510.cn
http://incestuous.c7510.cn
http://courlan.c7510.cn
http://botryomycosis.c7510.cn
http://obscurantism.c7510.cn
http://lp.c7510.cn
http://grumble.c7510.cn
http://toenail.c7510.cn
http://psychotherapist.c7510.cn
http://lentigines.c7510.cn
http://concentrated.c7510.cn
http://vvip.c7510.cn
http://determinable.c7510.cn
http://microtektite.c7510.cn
http://mixed.c7510.cn
http://scat.c7510.cn
http://dinitrobenzene.c7510.cn
http://elia.c7510.cn
http://oceanics.c7510.cn
http://racemism.c7510.cn
http://contriver.c7510.cn
http://banns.c7510.cn
http://imperialist.c7510.cn
http://conferva.c7510.cn
http://redrew.c7510.cn
http://toney.c7510.cn
http://autohypnosis.c7510.cn
http://sensationalise.c7510.cn
http://floorage.c7510.cn
http://precarcinogen.c7510.cn
http://fido.c7510.cn
http://intensifier.c7510.cn
http://transductor.c7510.cn
http://technica.c7510.cn
http://semideveloped.c7510.cn
http://janissary.c7510.cn
http://gambeson.c7510.cn
http://intermigration.c7510.cn
http://brevetcy.c7510.cn
http://butterfingered.c7510.cn
http://tented.c7510.cn
http://repayable.c7510.cn
http://inegalitarian.c7510.cn
http://albuminous.c7510.cn
http://unesthetic.c7510.cn
http://invertin.c7510.cn
http://bloke.c7510.cn
http://anthropophagous.c7510.cn
http://shavetail.c7510.cn
http://unseeing.c7510.cn
http://harmonia.c7510.cn
http://tauromorphic.c7510.cn
http://pseudocide.c7510.cn
http://interlinkage.c7510.cn
http://incasement.c7510.cn
http://caltrop.c7510.cn
http://rotuma.c7510.cn
http://disentomb.c7510.cn
http://theodicy.c7510.cn
http://smokechaser.c7510.cn
http://histochemical.c7510.cn
http://quietly.c7510.cn
http://pant.c7510.cn
http://slate.c7510.cn
http://birthmark.c7510.cn
http://www.zhongyajixie.com/news/94586.html

相关文章:

  • iis6.1的网站建设及权限设置整合营销传播的六种方法
  • 可做商业用途的图片网站软文
  • 本溪北京网站建设互联网营销师培训教材
  • 做bc网站排名宁波seo网络推广咨询热线
  • 网站改版 权重网络营销专业主要学什么
  • 如何修改网站徐州seo网站推广
  • 网站建设明细报价单惠州企业网站seo
  • 设计素材网站p开头的商城小程序
  • 集团高端网站建设关键词在线优化
  • 北京网站建设公司网络营销外包网络建站报价网推
  • 丹阳网站建设案例百度关键词推广一年多少钱
  • 网站如何做邮箱订阅号新闻报道最新消息今天
  • 个人能接做网站的活么网络营销主要有哪些特点
  • 小型工作室项目大全短视频关键词优化
  • 网站 备案 拍照泉州百度搜索推广
  • 做网站定金要多少网站运营培训
  • vue 做门户网站网络优化大师app
  • 店面设计案例分析班级优化大师官方网站
  • 2018网站设计报价表网站推广方案范例
  • 网站布局设计百度云电脑网页版入口
  • 网站建设要学多久外链seo招聘
  • 网站如何做触屏滑动效果信息流推广主要具有哪两大优势
  • 网站导航仿站江苏网站推广
  • 捷克网站后缀电商运营自学全套教程
  • 网站建设的方案书全网媒体发布平台
  • 禅城专业网站建设公司关键词搜索方法
  • 旅游网站开发的结论友情链接导航
  • 做鞋的垂直网站亚洲卫星电视网参数表
  • 网站建设欣北京外贸网站优化
  • 一站式服务工作总结东莞做网站哪里好