1. If an operator function with one parameter is a member of a class, which oper
ID: 638655 • Letter: 1
Question
1. If an operator function with one parameter is a member of a class, which operand is the owning instance?
class someclass
{
int operator+(int);
};
int a;
someclass b;
Is it a+b, or b+a, or something else?
the right
{ a+b }
the left
{ b+a }
neither
both
{ ab+ or ba+ }
2. What is true about a class template?
In C++11, the declaration of the class template can be placed in a header file (.h), and the definitions placed in the implementation file (.cpp) without the keyword 'extern'.
A template class is not actually created by the compiler until it parses a line of code creating a new instance of that class.
Only the class declaration need be prefaced with 'template , the class definitions, if defined outside the class specification, need not be prefaced with 'template .
'template ' is not the same as 'template ' for all types datatype.
a)the right
{ a+b }
b)the left
{ b+a }
c)neither
d)both
{ ab+ or ba+ }
Explanation / Answer
1. d
2. b
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.