0

The original poster that answer the question about interfaces, Technobabble: VB.NET Interfaces

Created a pretty good example. Unfortunately it have some errors to it and I don't know how to fix them The first one is:

Error 1 Type 'MyKey' is not defined.

The second: End of statement expected.

Specifically in JewlerySafe, House and car classes. Deleting the parentheses in: Public Sub OpenDoor(ByVal key As MyKey) Implements IOpenable.OpenDoor() <-- will get rid of the error messages but I'm not sure if that is correct.

I was trying to find a private message function to message the person but I couldn't find any. Also I tried finding a way to comment the old post but I guess its disabled after a certain amount of time.

Community
  • 1
  • 1
nhat
  • 1,159
  • 5
  • 21
  • 40

1 Answers1

2

1 - MyKey is not defined because it was not included in the example. Add this to remove that error..

Public Class MyKey
End Class

2 - Yes, remove the () at the end of the Implements InterfaceName.Method statements.

NoAlias
  • 9,218
  • 2
  • 27
  • 46
  • Ah ok thanks. I thought maybe mykey is suppose to do some type of function or something, not being empty. What's the point of having an empty class? – nhat Jul 26 '11 at 02:21
  • Well if it was more than just an example it would be more than an empty class. Since the example was for showing how to use an Interface, it was out of the scope to show the implementation of every class. – NoAlias Jul 26 '11 at 13:05