Interface implementation Diferences

Posted by carlos on Stack Overflow See other posts from Stack Overflow or by carlos
Published on 2010-05-21T00:07:19Z Indexed on 2010/05/21 0:10 UTC
Read the original article Hit count: 667

Filed under:

What is the diference of using interfaces like ...

I have an interface

Public Interface IProDataSource

    Function read() As Integer

End Interface

Then a class

Public Class DataSource : Implements IProDataSource

     Function read() As Integer Implements IProDataSource.read

         some code...

     End Function

End Class

Then I use this the next way ... but what is the difference? ... boths approaches are working ...

Dim obj As IProDataSource = New DataSource
obj.read()

vs

Dim datas as new Datasource
datas.read()

The only difference I have notice is that if the method is declare private it will be visible using the first approach only.

Thanks for any comments !!!

© Stack Overflow or respective owner

Related posts about vb.net