首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    《挑战30天C++入门极限》图文例解C++类的多重继承与虚拟继承

    //站点:www.cndev-lab.com //所有稿件均有版权,如要转载,请务必著名出处和作者 #include <iostream> using namespace std; class Vehicle { public: Vehicle(int weight = 0) { Vehicle::weight = weight; } void SetWeight(int weight) { cout<<"重新设置重量"<<endl; Vehicle::weight = weight; } virtual void ShowMe() = 0; protected: int weight; }; class Car:public Vehicle//汽车 { public: Car(int weight=0,int aird=0):Vehicle(weight) { Car::aird = aird; } void ShowMe() { cout<<"我是汽车!"<<endl; } protected: int aird; }; class Boat:public Vehicle//船 { public: Boat(int weight=0,float tonnage=0):Vehicle(weight) { Boat::tonnage = tonnage; } void ShowMe() { cout<<"我是船!"<<endl; } protected: float tonnage; }; class AmphibianCar:public Car,public Boat//水陆两用汽车,多重继承的体现 { public: AmphibianCar(int weight,int aird,float tonnage) :Vehicle(weight),Car(weight,aird),Boat(weight,tonnage) //多重继承要注意调用基类构造函数 { } void ShowMe() { cout<<"我是水陆两用汽车!"<<endl; } }; int main() { AmphibianCar a(4,200,1.35f);//错误 a.SetWeight(3);//错误 system("pause"); }   上面的代码从表面看,看不出有明显的语发错误,但是它是不能够通过编译的。这有是为什么呢?   这是由于多重继承带来的继承的模糊性带来的问题。   先看如下的图示:

    01

    准时下班的秘密:集成 GitLab && JIRA 实现自动化 workflow

    GitLab 和 Jira 是平时开发过程中使用非常高频的代码管理系统(开发人员)和项目管理系统(项目管理),通过两套系统的协作完成平常大多数的功能开发,但是两套系统在没有集成情况下是完全两套独立的系统,不仅信息没有互通,而且开发人员需要反复的登陆两套不同的系统,进行一些重复的操作才能保证功能流的正常流转,不仅效率低下,浪费时间和人力,而且因为人本身的不可靠属性,所以导致状态的流转并不能非常的及时和准确,这种重复和机械的动作恰恰是自动化所擅长的地方,今天我介绍一下如何集成 GitLab 和 Jira 的工作流,提高团队的开发体验,提升大家的开发效率,可以把腾出的精力和时间都放在更有价值的事情上

    01
    领券