找考题网-背景图
未分类题

有如下类定义: class Test { public: Test(){a=0;c=0} //① int f(int a)const{this->a=a;} //② static int g(){return a;} //③ void h(int b){Test::b;}; //④ private: int a; static int b; const int C; }; int Test::b=0; 在标注号码的行中,能被正确编译的是( )。
D.④

A.①
B.②
C.③

【参考答案】

D
解析:此题考查的是类的定义。一个类的长数据成员的初始化只能在成员初始化列表中进行,故选项A) 错误;常成员函数不能更新对象的数据成员,故选项B) 错误;静态成员函数可以直接访问类中说明的静态成员,但不能直接访问类中说明的非静态成员,故选项C) 错误。
热门试题

未分类题Culture is the sum total of all the traditions, customs, beliefs, and ways of life of a given group of human beings. In this (1)_____, every group has a culture, however un-developed or uncivilized it may seem to us.To the professional anthropologist, there is no intrinsic superiority of one culture (2)_____ another, just as to the professional linguist there is no intrinsic (3)_____ among the different languages.People once (4)_____ the languages of backward groups as savage, undeveloped (5)_____ of speech, consisting largely of grunts and groans. (6)_____ it is possible that language (7)_____ began as a series of grunts and groans, it is a fact established by the study of 'backward' languages (8)_____ no spoken tongue answers that description today. Most languages of (9)_____ groups are, by our most severe standards, extremely (10)_____, delicate, and ingenious pieces of machinery for the transfer of ideas. They (11)_____ behind our Western languages not in their sound patterns or grammatical structures, which usually are fully adequate for all language needs, (12)_____ only in their vocabularies, which reflect their speakers' social (13)_____.Even in this department, (14)_____, two things are to be noted: 1) All languages seem to (15)_____ the machinery for vocabulary expansion, either by putting together words already in existence (16)_____ by borrowing them from other languages and adapting them to their own system. 2) The objects and activities requiring names and (17)_____ in 'backward' languages, while different from ours, are often (18)_____ numerous and complicateD.A Western languages distinguishes merely between two degrees of remoteness ('this' and 'that'); some languages of the American Indians distinguish between what is close to the speaker or to the person (19)_____ and what is removed from both, or out of sight, or in the past, or in the futurE.This study of language, in turn, (20)_____ a new light upon the claim of the anthropologists that all cultures are to be viewed independently, and without ideas of rank.A.perspectiveB.senseC.dimensionD.manner

A.B.
C.
D.
E.
A.perspective
B.sense
C.dimension