• Register
0 votes

When I encountered this problem, I attempted to find a solution on the internet but was unable to find any useful details. If you read the above query and understand what the solution is, please cooperate with me- Thanks.

51.5k points

Please log in or register to answer this question.

1 Answer

0 votes


I see your query, and this problem does not appear to be too difficult, so please check to see if you can solve it.... 

The phrase "overloading the default constructor" is non-sensical:

  • Overloading refers to having multiple methods with the same name but different parameters lists.
  • The default constructor is the no-argument constructor that the compiler generates for you if you don't specify any other constructor. It has no arguments by definition.
  • Since overloading requires different parameter lists and the default constructor by definition only has one possible parameter list (the empty one), these two concepts don't interact in a meaningful way.

You can specify your own no-argument constructor and thus stop the compiler from generating the default constructor, but I would not call that "overloading the default constructor".

48.9k points