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

下面是类MyClass的定义,对定义中各语句描述正确的是( )。 class MyClass { private: int x,y, z; public: void MyClass(int A) { x=a; } //① int f(int a, int B) //② { x=a; y=b; } int f(int a,
A.语句①是类MyClass 的构造函数的定义
B.语句②和③实现类成员函数的重载
C.语句④实现对类成员变量x的更新操作
D.语句①、②、③和④都不正确

A.语句①是类MyClass
B.语句②和③实现类成员函数的重载
C.语句④实现对类成员变量x的更新操作

【参考答案】

D
解析:在C++中构造函数没有返回类型,所以语句①是错误的。语句②和语句③在进行f(x,y)调用时会产生二义性。静态成员函数不能直接访问类中说明的非静态成员。所以语句④也是错误的。
热门试题

未分类题The fact that blind people can 'see' things using other parts of their bodies apart from their eyes may help us to understand our feelings about color. If they can (1)_____ color differences, then perhaps we, too, are affected by (2)_____ unconsciously. Manufacturers have discovered by (3)_____ that sugar sells badly in green wrappings, (4)_____ blue foods are considered unpleasant, and the cosmetics should never be packaged (5)_____ brown. These discoveries have grown (6)_____ a whole discipline of color psychology that now finds (7)_____ in everything from fashion to interior decoration. Some of our (8)_____ are clearly psychological. Dark blue is the color of the night sky and (9)_____ associated with passivity and calm, while yellow is a day color with (10)_____ of energy and incentivE.For primitive man, activity during the day (11)_____ hunting and attacking, while he soon saw as red, the color of blood and rage and the heat that came (12)_____ effort. And green is associated with passive (13)_____ and self preservation. Experiments have (14)_____ that green, partly bemuse of its physiological associations, also has a direct psychological (15)_____, it is a calming color. (16)_____ its exciting connotations, red was chosen as the signal for changer, (17)_____ closer analysis shows that a vivid yellow can produce a (18)_____ basic state of alertness and (19)_____, so fire engines and ambulances in some advanced communities are now (20)_____ around in bright yellow colors that stop the traffic deaD.A.seeB.reckonC.distinguishD.sense

A.A.see
B.reckon
C.distinguish