Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2350764
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:03:12

#include
using namespace std;
class jj
{
public:
jj(int hh=191)
{
this->hh=hh;
}
int hh;
};
class Student :virtual public jj
{
public:
Student(int aa0=10):jj(hh)
{
this->aa0=aa0;
}
int dis();
int aa0;
~Student();
};
Student::~Student()
{
cout<<"jsdkljl"<}
int Student::dis()
{
cout<<"Student.aa0"< return 0;
}
/////////////////////////////////////
class Student1:virtual public jj
{
public:
Student1(int aa1=100):jj(hh)
{
this->aa1=aa1;
}
int dis();
int aa1;
~Student1();
};
Student1::~Student1()
{
cout<<"jsdkljl"<}
int Student1::dis()
{

cout<<"Student1.aa1"< return 0;
}
//////////////////////
class Student2:public Student,public Student1
{
public:
Student2(int hh=11,int aa0==11,int aa1=11,int aa2=1000):jj(hh),Student(aa0),Student1(aa1),aa2(aa2)
{
//this->aa2=aa2;
}
int dis2();
int aa2;
};
int Student2::dis2()
{
Student1::dis();
cout<<"aa"< cout<<"aa"< cout<<"aa"< return 0;
}
int main()
{
Student2 stu;
stu.dis2();
cout< stu.Student::dis();
cout< cout<
return 0;
}

--------------------next---------------------
#include
using namespace std;
class jj
{
public:
jj(int hh)
{
this->hh=hh;
}
int hh;
};
class Student :virtual public jj
{
public:
Student(int aa0,int hh):jj(hh),aa0(aa0)
{
//this->aa0=aa0;
}
int dis();
int aa0;
~Student();
};
Student::~Student()
{
cout<<"jsdkljl"<}
int Student::dis()
{
cout<<"Student.aa0"<return 0;
}
/////////////////////////////////////
class Student1:virtual public jj
{
public:
Student1(int aa1,int hh):jj(hh),aa1(aa1)
{
//this->aa1=aa1;
}
int dis();
int aa1;
~Student1();
};
Student1::~Student1()
{
cout<<"jsdkljl"<}
int Student1::dis()
{

cout<<"Student1.aa1"<return 0;
}                                                                                                                    
//////////////////////
class Student2: public Student, public Student1
{
public:
Student2(int hh=11,int aa0=22,int aa1=33,int aa2=44):jj(hh),Student(aa0,hh),Student1( aa1,hh),aa2(aa2){}
//{
//this->aa2=aa2;
//}
int dis2();
int aa2;
};
int Student2::dis2()
{
Student1::dis();
cout<<"aa"<cout<<"aa"<cout<<"aa"<return 0;
}
int main()
{
Student2 stu;
stu.dis2();
cout<stu.Student::dis();
cout<cout<
return 0;
}


--------------------next---------------------

阅读(1095) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~