Which constructor definition will produce a compile time error?
Answers
Answered by
1
Answer:
Constructors doesn't have any return type so can't be overloaded using return type. If constructors have same signature then it will produce a compile time error. Explanation: The constructor should use all the default arguments. This will allow the constructor to be called even if no arguments are passed.
Answered by
0
If the constructor calling is not in the first statement while defining, then it will produce compile time error.
Explanation:
In order to include constructor overloading in a program, we have to follow certain steps,
- The constructor should be called in the 1st statement of constructor.
- If parameterized constructor is defined, then the compiler will not create any default constructor. If we did not define any constructor, the compiler itself will create the default constructor during compilation.
Learn more about constructor
Write any four differences between Constructor and Destructor function with respect to object oriented programming
https://brainly.in/question/7428175
How to call constructors in JAVA during constructor overloading?
https://brainly.in/question/6086771
Similar questions
Computer Science,
6 months ago
Math,
1 year ago