0

I am working on a class that implements an interface.

I found a road block when I try to implement an enumeration. Is that possible?

Example:

IFruits
Public enum enuFruits
End enum
Public Sub AddNewToCollection(ByVal TypeSelected as enuFruits)
End sub

CApple
Implements Ifruits

Private enum enuFruits
End enum
Private Sub IFruits_AddNewToCollection(ByVal TypeSelected as enuFruits)
End sub

This code above, does NOT work. An empty enumeration can't be declared.

The idea behind is: Different implementations would make us of an unique enumeration (different number of items/types). But in the end all of them will implement in in the interface procedure.

This enumeration is a mere help for ease coding. For now I have a procedure that prints out to the inm window so I can quickly choose, but would be cool to have intellisense.

I've tried multiple theories:

  • Implementing defined "Type" that contains list of enumerations and then declaring it in the modules.
  • Multiple nesting property get/let wishing that at some point magic happens.

I just can't get it around... maybe It can't be done. I want to move on :D

Community
  • 1
  • 1
Charlie
  • 101
  • 2
  • 16
  • If classes have different Enumerations, they aren't implementing the same interface. Period. You can make this "work" by declaring the parameter as `Long`, but it still doesn't resolve the design problem. – Comintern Oct 03 '16 at 20:17
  • @Comintern I was thinking it overnight. I believe you are right, I will go with just different classes and forget about the interface. Many thanks for the tip, much appreciated! – Charlie Oct 04 '16 at 05:11

0 Answers0