Which constructor definition will produce a compile time error?

Which constructor definition will produce a compile time error?
A. className(int x=0);
B. className(char c);
C. className(int x=0,char c);
D. className(char c,int x=0);
 
Answer: c
Explanation: The default arguments, just like with member functions, must be listed at last in the argument list. Hence this will produce a compile time error. The compiler doesn’t allow the definition to be executed.
 

Tìm kiếm

Back
Top