|
|
| Author |
Message |
victorf
Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York
|
|
Posted: 10 March 2006, 23:03 PM Post subject: Passing Enumerated Types to routine |
|
|
If I have an enumerated type such as:
| Code: |
Enum Pet
Dog
Bird
Snake
End Enum
Dim p as Pet
p.Snake = Boa
Call Sub(p)
Public Sub (ByVal et as Pet)
if et.Snake = Boa then
do something
end if
End Sub
|
Is the sub structured correctly
Any enlightenment will be appreciated.
Vic |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 11 March 2006, 1:13 AM Post subject: |
|
|
Not quite. An enumerated type is defined by specifying the values that a variable of that enumerated type may assume. ( Beneath the covers, the compiler assigns numeric values to the members of the type unless you specify values explicitly but those values are largely immaterial.)
| Code: | Enum Pet
Dog
Bird
Snake
End Enum
Dim p as Pet
p = Snake
Call Sub(p)
Public Sub (ByVal et as Pet)
if et = Snake then
do something
end if
End Sub |
|
|
| Back to top |
|
 |
victorf
Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York
|
|
Posted: 11 March 2006, 12:33 PM Post subject: |
|
|
Oh I see. Thanks for clarifying this for me.
Vic |
|
| Back to top |
|
 |
|