- 相關(guān)推薦
筆試題(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;
}
///////////////////////////////////////////////////////
運行的結(jié)果是
1
1
1
1
1
0
1
1
【筆試題using namespace std】相關(guān)文章:
Using the Telephone07-27
迅雷2011.10.21筆試題08-10
中興2015筆試題08-02
Tips for Using Resume Templates or Examples07-28
筆經(jīng):加強型試題07-22
海爾04年筆試題及答案07-31
交通銀行2014筆試題題目分享08-10