摘要:
有如下定义:class A {};class B : public A{};A* pA = new B;下列代码无法完成转换的是( )A) B* pB = static_cast<B*>(pA);B) B* pB = reinterpret_cast<B*>(pA);C) B* pB = dynamic_cast<B*>(pA);D) B* pB = (B*)p... 阅读全文
摘要:
下面代码执行后,正确的输出是( ) char *a ="Hello"; char b[6]="Hello"; if (a==b) { if (*a == *b) printf(“AA”); else printf(“BB”); } else { if (*a == *b) printf(“CC”); else printf(... 阅读全文
摘要:
#include<iostream>#include<complex>using namespace std;class Base{public:virtual void f( int iParam){cout << "Base::f(int)" << endl;};virtual void f( double dParam){cout <&l... 阅读全文
摘要:
#include<iostream>using namespace std;class Base{public:virtual void g( int i = 10 ){cout << i << endl;};};class Derived: public Base{public:void g( int i = 20 ){cout << "Deriv... 阅读全文
摘要:
class A {public: virtual void op(); ……};class B : public A {public: void op(); // 在这个函数中会调用anotherOperator,但anotherOperator不是虚函数 void anotherOp(); ……};A* a = new B;a-&... 阅读全文