Overloaded constructor and precautions

Constructor Category:

  Implicit constructor

    When a class, not manually configured the preparation method , the system provides a default constructor with no arguments

  Explicit Construction

    When a class structure written in a manual method, the system does not provide a default constructor with no arguments

If the selected to delete, then there will be the following error: Because the constructor is not found

    It is recommended that: When writing a manual configuration method, write your constructor with no arguments, then write the constructor needs

 

 

  The case wrong reasons: the same number, the same type so in this case, when the number of the same type must be or else such as the one of the String class into other types

 

Overloaded constructor:

  In the same class, the name must be the same method of construction, different parameter list (different numbers, different types, different order)

 

Guess you like

Origin www.cnblogs.com/penphy/p/10929304.html