单选题将前缀运算符“--”重载为非成员函数,下列原型中,能正确用于类中说明的是( )。ADeer operator--(int);BDeer operator--(Deer,int);Cfriend Deer operator--(Deer);Dfriend Deer operator--(Deer,int);
单选题
将前缀运算符“--”重载为非成员函数,下列原型中,能正确用于类中说明的是( )。
A
Deer& operator--(int);
B
Deer operator--(Deer&,int);
C
friend Deer& operator--(Deer&);
D
friend Deer operator--(Deer&,int);
参考解析
解析:
前缀运算符“--”的操作结果有左值数据,重载时应保持这一特性。因此运算符函数的返回值应声明为引用,类型为Deer&;前缀运算符“--”要求第一操作数必须是有左值的操作数,因此对应于第一操作数的第一参数必须声明为引用参数,类型为Deer&。
前缀运算符“--”的操作结果有左值数据,重载时应保持这一特性。因此运算符函数的返回值应声明为引用,类型为Deer&;前缀运算符“--”要求第一操作数必须是有左值的操作数,因此对应于第一操作数的第一参数必须声明为引用参数,类型为Deer&。
相关考题:
Some people are against killing wolves because .A.wolves help to keep the ecological balance in the wildemessB.there is too small a wolf population in the wildernessC.there are too many deer in the wildernessD.wolves are afraid of people and never attack people
( 14 )将前缀运算符 “ -- ” 重载为非成员函数,下列原型中,能正确用于类中说明的是A ) Decr operator --(int);B ) Decr operator --( Decr,int);C ) friend Decr operator --(Decr);D ) frlend Decr operator --(Decr,int);
如果表达式--x/y中的“--”和“/”是作为友元函数重载的运算符,采用运算符函薮调用格式,该表达式还可表示为( )。A.operator/(x.operato--(), y);B.operator/(operator--(x), y);C.x.operator--().operator/(y);D.y.operator/(operator--(x));
如果表达式-x/y中的“--”和“/”是作为友元函数重载的运算符,采用运算符函数用格式,该表达式还可表示为( )。A.operator/(x.operator--(),y);B.operator/(operator--(x),y);C.x.operator--().operator/(y);D.y.operator/(operator--(x));
将前缀运算符“--”重载为非成员函数,下列原型中,能正确用于类中说明的是( )。A.Decroperator--{int};B.Decroperator--(Decr,int);C.friend Decr cperator--(Decr);D.friend Decr operacor--(Decr,int);
It is said that a deer can run ( ) as a goal. A、three times fasterB、three times as fastC、as three times fastD、as fast three times
将前缀运算符“--”重载为非成员函数,下列原型中能正确用于类中说明的是( )。A.DeCroperator--(int);B.DeCr operator--(DeCr,int);C.friend DeCroperator--(DeCr);D.friend DeCr operator--(DeCr,int);
如果表达式--x/y中的“--”和“/”都是作为友元函数重载的运算符,采用运算符函数调用格式,该表达式还可表示( )。A.operator/(x. operator--(),y)B.operator/(operator--(x),y)C.x. operator--().operator/(y)D.y. operator/(operator--(x))
将前缀运算符“一一”重载为非成员函数,下列原型中,能正确用于类中说明的是( )。A.Deeroperator一一{int};B.Decroperator一一(Decr,int);C.friendDeercperator一一(Deer);D.friendDeeroperacor一一(Deer,int);
将前缀运算符“--”重载为非成员函数,下列原型中能正确用于类中说明的是( )。A.DeCr&operator--(int);B.DeCr operator--(DeCr&,int);C.friend DeCr&operator--(DeCr&);D.friend DeCr operator--(DeCr&,int);
单选题What measure was NOT taken by the author to deter the deer?AurineBgun shotsCwatchdogDdeodorant soup
单选题The author collects hair in bags to prevent the invasion of deer because he knows that _____.Adeer like the smell of human hairBdeer can be repelled by the smell of human hairCdeer die when eating human hairDdeer flee at the sight of human hair
单选题如果表达式--x/y中的“--”和“/”是作为友元函数重载的运算符,采用运算符函数调用格式,该表达式还可表示为( )。Aoperator/(x.operator-(),y);Boperator/(operator--(x),y);Cx.operator--().operator/(y);Dy.operator/(operator--(x))
单选题Groups of ______ and ______ are eating ______ and ______ at the foot of the hill.Asheep; deer; grass; leavesBsheeps; deers; grass; leavesCsheep; deer; grass; leafDsheeps; deers; grasses; leaves
单选题Why did the electric fence fail? It is because of _____.AThe deer are smartBThe winter is coldCThe fence is of low qualityDSnowpack serves as an insulator
问答题简述下列词语意义的演变情况 (1)墨水 (2)牺牲 (3)deer (4)事故 (5)泰