- 相关推荐
笔试题(using namespace std)
using namespace std;
class A
{
protected:
int m_data;
public:
A(int data = 0){m_data = data; }
int GetData(){return doGetData();}
virtual int doGetData(){ return m_data;}
};
class B:public A
{
protected:
int m_data;
public:
B(int data = 1){m_data = data; }
int doGetData(){ return m_data;}
};
class C:public B
{
protected:
int m_data;
public:
C(int data = 2){m_data = data; }
};
int main()
{
C c(10);
cout<<c.GetData()<<endl;
cout<<c.A::GetData()<<endl;
cout<<c.B::GetData()<<endl;
cout<<c.C::GetData()<<endl;
cout<<c.doGetData()<<endl;
cout<<c.A::doGetData()<<endl;
cout<<c.B::doGetData()<<endl;
cout<<c.C::doGetData()<<endl;
system("PAUSE");
return 0;
}
///////////////////////////////////////////////////////
运行的结果是
1
1
1
1
1
0
1
1
【笔试题using namespace std】相关文章:
Using the Telephone07-27
迅雷2011.10.21笔试题08-10
中兴2015笔试题08-02
Tips for Using Resume Templates or Examples07-28
笔经:加强型试题07-22
海尔04年笔试题及答案07-31
银行2014笔试题目及经验分享03-16
交通银行2014笔试题题目分享08-10