(27)下列程序段中包含4個(gè)函數(shù),其中具有隱含this指針的是
int fun1();
class Test{
public:
int fun2();
friend int fun3();
static int fun4();
};
A)fun1
B)fun2
C)fun3
D)fun4
(28)有如下程序
#include
using namespace std;
class Test{
public:
Test(){ }
Test(const Test &t) {cout<<1;}
};
Test fun(Test &u) {Test t=u; return t;}
int main(){Test x,y; x=fun(y); return 0;}
運(yùn)行這個(gè)程序的輸出結(jié)果是
A)無輸出
B)1
C)11
D)111
(29)有如下程序
#include
using namespace std;
class A{
public:
A(int i=0):r1(i) { }
void print() {cout<<'E’<
void print() const {cout<<'C'<
void print(int x) {cout <<'P'<
private:
int r1;
};
int main() {
A a1;
const A a2(4);
a1.print(2);
a1.print();
return 0;
}
運(yùn)行時(shí)的輸出結(jié)果是
A)P8-E4
B)P8-C16-
C)P0-E4-
D)P0-C16-
(30)下列代碼聲明了3個(gè)類
class Person{};
class Student:public Person{};
class Undergraduate:Student{};
下列關(guān)于這些類之間關(guān)系的描述中,錯(cuò)誤的是
A)類Person是類Undergraduate的基類
B)類Undergraduate從類Student公有繼承
C)類Student是類Person的派生類
D)類Undergraduate是類Person的派生類
北京 | 天津 | 上海 | 江蘇 | 山東 |
安徽 | 浙江 | 江西 | 福建 | 深圳 |
廣東 | 河北 | 湖南 | 廣西 | 河南 |
海南 | 湖北 | 四川 | 重慶 | 云南 |
貴州 | 西藏 | 新疆 | 陜西 | 山西 |
寧夏 | 甘肅 | 青海 | 遼寧 | 吉林 |
黑龍江 | 內(nèi)蒙古 |