var name same as type-declared-as' name

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

apparently there is no problem with naming a local variable with the same
name as the type it is declared as .... ?

Public MyClass
Enum SpecialID
Special1 = 1
....
End Enum
Public Function MyFunction
Dim SpecialID As SpecialID
SpecialID = SpecialID.Special1
End Function
End Class
 
John,

* "John A Grandy said:
apparently there is no problem with naming a local variable with the same
name as the type it is declared as .... ?

Public MyClass
Enum SpecialID
Special1 = 1
....
End Enum
Public Function MyFunction
Dim SpecialID As SpecialID
SpecialID = SpecialID.Special1
End Function
End Class

No, there is no problem. 'SpecialID' is not a keyword, so you don't
need square brackets around the variable's name.
 
Back
Top