I can't get a handle on the syntax. Can anyone give me a simple demo?
Upvotes: 1
Views: 667
Reputation: 35117
It's been awhile but I think it's just:
Class MyClass : Inherits MyBaseClass : Implements IMyInterface1, IMyInterface2
The : are just so you can do it all on one line. If you don't use them it looks like:
Class MyClass
Inherits MyBaseClass
Implements IMyInterface1, IMyInterface2
Which is confusing if you're looking at a C# example because in that the colon is the inherit operator.
Upvotes: 9
Reputation: 4876
In VB.NET a class can only inherit from one base class. A VB.Net class can implement multiple interfaces.
Inherits statement:
Public Class thisClass
Inherits anotherClass
End Class
Implementing an interface:
Public Class thisClass
Implements IComparable, IDisposable
End Class
Both Inheriting and implementing in VB.NET:
Public Class thisClass
Inherits anotherClass
Implements IComparable, IDisposable
End Class
Upvotes: 3
Reputation: 56735
You cannot inherit implementations from more than one place in VB & C#, afaik. I guess you can do multiple Interface inheritance, though.
Upvotes: 1