The only way to declare more than one entity of the same kind with the same name in a declaration space is through overloading. Overloading may only occur on type members, specifically methods, instance constructors and properties. Signatures are the enabling mechanism for the overloading of type members — every type member that can be overloaded has a signature. A name may have several type members overloaded on it, provided that the signatures of all the type members are unique.
The signature of a type member is made up of the name of the type member and the number and types of its formal parameters (unlike previous versions, Visual Basic 7.0 considers enumerations distinct types). It is important to note that the following play no part in signatures: modifiers to a signature (Shared
, etc), modifiers to a parameter (ByVal
, ByRef
), the names of parameters, the return type of a method, and the element type of a property. It is not possible to overload on any of these things.
A method with optional parameters is considered to have multiple signatures, one for each of the possible parameter lists that can be specified by the caller. A method with a paramarray parameter is considered to have an infinite number of signatures: one with the explicit type of the paramarray (that is, a single-dimensional array), and then a progression of signatures starting with the parameter list without the paramarray and successively adding parameters of the element type of the paramarray.