本文主要是介绍阅读程序,写结果4,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
/**Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:text.cpp
*作者:汤善晔
*完成日期:2016年8月19日
问题描述:阅读程序,写结果
*版本号:v1.0
*/
#include <iostream>
using namespace std;
class Base
{
public:
Base(char i)
{
cout<<"Base constructor-"<<i<<endl;
}
};
class Derived1:virtual public Base
{
public:
Derived1(char i,char j):Base(i)
{
cout<<"Derived1 constructor-"<<j<<endl;
}
};
class Derived2:virtual public Base
{
public:
Derived2(char i,char j):Base(i)
{
cout<<"Derived2 constructor-"<<j<<endl;
}
};
class MyDerived:public Derived1,public Derived2
{
public:
MyDerived(char i,char j,char k,char l,char m,char n,char x):
Derived2(i,j),Derived1(k,l),Base(m),d(n)
{
cout<<"MyDerived constructor-"<<x<<endl;
}
private:
Base d;
};
int main()
{
MyDerived obj('A','B','C','D','E','F','G');
return 0;
这篇关于阅读程序,写结果4的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!