Same Name. Each overloaded version must use the same procedure name.
Different Signature. Each overloaded version must differ from all other overloaded versions in at least one of the following respects:
Number of parameters
Order of the parameters
Data types of the parameters
Number of type parameters (for a generic procedure)
Return type (only for a conversion operator)
Together with the procedure name, the preceding items are collectively called the signature of the procedure. When you call an overloaded procedure, the compiler uses the signature to check that the call correctly matches the definition.
Items Not Part of Signature. You cannot overload a procedure without varying the signature. In particular, you cannot overload a procedure by varying only one or more of the following items:
Procedure modifier keywords, such as Public, Shared, and Static
Parameter or type parameter names
Type parameter constraints (for a generic procedure)
Parameter modifier keywords, such as ByRef and Optional
Whether it returns a value
The data type of the return value (except for a conversion operator)
The items in the preceding list are not part of the signature. Although you cannot use them to differentiate between overloaded versions, you can vary them among overloaded versions that are properly differentiated by their signatures.
Different Signature. Each overloaded version must differ from all other overloaded versions in at least one of the following respects:
Number of parameters
Order of the parameters
Data types of the parameters
Number of type parameters (for a generic procedure)
Return type (only for a conversion operator)
Together with the procedure name, the preceding items are collectively called the signature of the procedure. When you call an overloaded procedure, the compiler uses the signature to check that the call correctly matches the definition.
Items Not Part of Signature. You cannot overload a procedure without varying the signature. In particular, you cannot overload a procedure by varying only one or more of the following items:
Procedure modifier keywords, such as Public, Shared, and Static
Parameter or type parameter names
Type parameter constraints (for a generic procedure)
Parameter modifier keywords, such as ByRef and Optional
Whether it returns a value
The data type of the return value (except for a conversion operator)
The items in the preceding list are not part of the signature. Although you cannot use them to differentiate between overloaded versions, you can vary them among overloaded versions that are properly differentiated by their signatures.
No comments:
Post a Comment
Please Provide your feedback here