The code works without a constructor, obviously.
Why do we need an empty constructor in the NormalCat class?
Resolved
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Lisa
1 January 2022, 16:20solution
The task is not to remove everything possible so that the code still compiles but just to remove everything superfluous (everything the compiler adds automatically when compiling the code). The default constructor won't get added by the compiler when there is another constructor added by the programmer. And that's the case here. So you must not remove the no-arg one.
+5
PeterC Android Developer
1 January 2022, 17:09
Thanks, Lisa. You're saving the day again.
+1
Dawn( #11020889)
12 October 2022, 04:40
Thank you Lisa for your helpful explanation.
0