declare argument to ccept OR

  • Thread starter Thread starter Cc
  • Start date Start date
C

Cc

hi,
how do I create function that allow argument to accept combine enum using
OR. and how do I extract the argument value inside the function.
 
Look into Polymorphism... you want to overload a method declaration to
handle different "scenarios" of how data is passed into the fucntion.

-CJ
 
Cc said:
hi,
how do I create function that allow argument to accept combine enum
using OR. and how do I extract the argument value inside the
function.

<Flags()> _
Public Enum MyEnum
a = 1
b = 2
c = 4
End Enum
Sub test(ByVal param As MyEnum)
If (param And MyEnum.a) = MyEnum.a Then
'a is set
End If
End Sub
Sub AnotherTest()
test(MyEnum.a Or MyEnum.b)
End Sub
 
Hello,

Cc said:
how do I create function that allow argument to accept
combine enum using OR. and how do I extract the
argument value inside the function.

\\\
<Flags()> _
Public Enum Bla
Const1 = 1
Const2 = 2
Const3 = 4
Const4 = 8
End Enum
..
..
..
Foo(Bla.Const2 Or Bla.Const4)
..
..
..
Public Sub Foo(ByVal x As Bla)
MsgBox(((x And Bla.Const2) = Bla.Const2).ToString())
End Sub
///
 
Back
Top