Two Interfaces, One Method, Two Meanings (VB)
Last week I showed how to implement two interfaces with one method and two meanings in CSharp. One of the first comments I received for this post was, “How does this work in VB.NET?”
So here’s how it works:
First we’ll need to set up our interfaces:
Public Interface English Property Height() As Integer End Interface Public Interface Metric Property Height() As Integer End Interface
And next, our class:
Public Class person Implements English, Metric Public Property Height() As Integer _ Implements English.Height Get End Get Set(ByVal value As Integer) End Set End Property Public Property Height1() As Integer _ Implements Metric.Height Get End Get Set(ByVal value As Integer) End Set End Property End Class
You’ll notice that because VB automatically implements the properties, there is very little you have to worry about as you implement this problem. In fact, the Handles clause does all the work for us meaning that we don’t even have to implement a separate Height property for the Person class. You can call Height or Height1 directly off of Person, or you can cast Person to English or Metric and call Height off of either of those types.
Other Related Items:
Drive USB 2GB Swivel Bulk 25/Bucket25/Bucket2gb swivel drive - 25 pack bulk. Green blue and orange.
Beginning ASP.NET 3.5: In C# and VB (Programmer to Programmer)This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain... Read More >
Microsoft Visual Studio Professional 2005 [OLD VERSION]Visual Studio 2005 Professional Edition offers developers exactly what they need: A high productivity professional development environment for working... Read More >









