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

网站产品图怎么做的刷百度关键词排名优化

网站产品图怎么做的,刷百度关键词排名优化,北京突现狂风暴雨,修改wordpress后台图标关于隐藏 (hidden) 假如继承以后&#xff0c;子类出现父类同名函数&#xff0c; 即使参数的形式不同&#xff0c; 也会导致父类的函数隐藏&#xff0c; 不参与函数匹配&#xff0c;不能使用。 这个链接讲的不错。https://zhuanlan.zhihu.com/p/575423511 #include <iostrea…

关于隐藏 (hidden)
假如继承以后,子类出现父类同名函数, 即使参数的形式不同, 也会导致父类的函数隐藏, 不参与函数匹配,不能使用。
这个链接讲的不错。https://zhuanlan.zhihu.com/p/575423511

#include <iostream>
using namespace std;
class Vehicle {
public:void accelerate() { cout << "Increasing speed: "; }
};
class Aeroplane : public Vehicle {public:void accelerate(int height) {cout << "Accelerating at a height of: " << height;}
};int main() {Aeroplane plane;plane.accelerate(1000);plane.accelerate();  //这里出错!main.cpp:17:25: error: no matching function for call to ‘Aeroplane::accelerate()’cout << endl;
}

如果子类的instance就是想调用父类的同名不同参的函数呢?方法有两个。

  1. 显式调用父类版本的函数
    b.A::func(); // 显式指定父类版本,合法
    #include
    using namespace std;
    class Vehicle {
    public:
    void accelerate() { cout << "Increasing speed: "; }
    };
    class Aeroplane : public Vehicle {
    public:
    void accelerate(int height) {
    cout << "Accelerating at a height of: " << height;
    }
    };

int main() {
Aeroplane plane;
plane.accelerate(1000);
plane.Vehicle::accelerate();
cout << endl;
}

  1. 用using
    using A::func; // 解开父类重载函数的默认隐藏。
#include <iostream>
using namespace std;
class Vehicle {
public:void accelerate() { cout << "Increasing speed: "; }
};
class Aeroplane : public Vehicle {public:using Vehicle::accelerate;void accelerate(int height) {cout << "Accelerating at a height of: " << height;}
};int main() {Aeroplane plane;plane.accelerate(1000);plane.accelerate();cout << endl;
}
  1. 当然也可以直接在子类的函数里面调用
class Aeroplane : public Vehicle {public:void accelerate(int height) {Vehicle::accelerate();  cout << "Accelerating at a height of: " << height;}
};

关于overload

关于override
如果不用virtual,怎么实现多态呢?可以用cast。但是对不同子类的object都要cast到对应的子类类型,显然很不方便。
static_cast<Circle *>(s)->draw();

#include <iostream>
#include <vector>using namespace std;class Shape {
public:void draw() { cout << "Drawing a generic shape...\n"; }
};class Circle: public Shape {
public:void draw() { cout << "Drawing a circle...\n"; }
};int main() {vector<Shape *> shapes;      // Vector of pointers to Shape instances// Create a pointer to a child class of Shape and append it to the vector shapes.push_back(new Circle);for (auto s: shapes)static_cast<Circle *>(s)->draw();      for (auto s : shapes)       // Release allocated memorydelete s;
}
http://www.zhongyajixie.com/news/64377.html

相关文章:

  • 罗湖网站建设的公司seo快速软件
  • 班级管理网站开发论文合肥seo优化外包公司
  • vs做网站如何发布网站制作网站推广
  • 番禺做网站搜狗网页版入口
  • wordpress的用户分企业整站优化
  • 眉山建网站百度网站的优化方案
  • 云工厂网站建设crm
  • 国际免费b2b大全武汉seo网络优化公司
  • 做企业网站用什么程序网站生成器
  • 如何360收录网站北京企业网站推广哪家公司好
  • 北京城乡建设学校网站电商平台推广方式有哪些
  • 个人网站可以做淘宝客嘛关键词优化排名
  • 广东网站建设服务商最有效的免费推广方法
  • ps做网站大小尺寸网络营销推广的特点
  • 开封企业网站建设seo标题优化步骤
  • 如何做古诗词网站网站seo视频狼雨seo教程
  • 用ps做三网站横幅长沙网站优化公司
  • 政府网站数据库错误北京知名seo公司精准互联
  • 天水 网站建设招聘怎样推广一个产品
  • 返利网 网站开发网推拉新app推广平台
  • 政务公开网站开发有效果的网站排名
  • wordpress 地址修改淮南网站seo
  • 自己做企业网站可以吗成都高端网站建设哪家好
  • 上海中小企业服务中心淄博seo网站推广
  • 做企业门户网站站长之家统计
  • 苏州新区网站制作洗发水营销推广软文800字
  • 网站做预览文档谷歌搜索引擎入口363
  • 微信开发网站建设程序百度网盘pc端网页版
  • 怎么把自己做的网站放上网络天津百度关键词seo
  • wordpress文本编辑器厦门百度关键词seo收费