-> -> ->
2009年全国计算机等级考试二级C++笔试模拟题(六)(二)
时间:2011-02-07 13:10:39
微信搜索关注"91考试网"公众号,领30元,获取事业编教师公务员等考试资料40G
amespace std;Class Test {public: Test( ){ n+=2; } ~Test( ){ n-=3; } static int getNum( ) { return n; }private: static int n;};int Test::n = 1;int main( ){ Test* p = new Test; delete p; cout << "n=" <A.n=0B.n=1C.n=2D.n=3 参考答案: A n=0----------------------------------------10、 有如下程序:#includeusing namespace std;Class A {public: A( ) { cout << "A"; }};Class B { public: B( ) { cout << "B"; } };Class C : public A { B b;public: C( ) { cout << "C"; }};int main( ) { C obj; return 0; }执行后的输出结果是 A.CBAB.BACC.ACBD.ABC 参考答案: D ABC
微信搜索关注"91考试网"公众号,领30元,获取公务员事业编教师考试资料40G