Can I
Member
hello,
I'm using Visual Web Developer and am just beginning with VB.NET. I've came accross a strange problem - I have DAO inteface and want to implement it:
and
but the IDE tells:
for me the code looks correct, but I'm probably making some stupid mistake, as I've never been writing in VB before
I'm using Visual Web Developer and am just beginning with VB.NET. I've came accross a strange problem - I have DAO inteface and want to implement it:
VB.NET:
Imports model
Imports Microsoft.VisualBasic
Namespace dao
Public Interface BookDAO
Function findAllBooks() As ArrayList
Function findById(ByVal id As Integer) As Book
End Interface
End Namespace
and
VB.NET:
Imports model
Imports Microsoft.VisualBasic
Namespace dao
Public Class AccessBookDAO
Implements BookDAO
Private books As New ArrayList
Private Shared instance As AccessBookDAO
Private Sub New()
Dim book1 As New Book
book1.description = "book1 desc"
book1.id = 1
book1.price = 3.5
book1.publisherId = 1
book1.title = "book 1"
book1.year = 2006
books.Add(book1)
End Sub
Public Shared Function getInstance() As AccessBookDAO
If instance Is Nothing Then
instance = New AccessBookDAO()
End If
Return instance
End Function
Public Function findAllBooks() As ArrayList
Return books
End Function
Public Function findById(ByVal id As Integer) As Book
Dim result As Book
For Each book As Book In books
If book.id = id Then
result = book
Exit For
End If
Next
Return result
End Function
End Class
End Namespace
but the IDE tells:
Error 2 Class 'AccessBookDAO' must implement 'Function findAllBooks() As System.Collections.ArrayList' for interface 'BookDAO'. C:\Documents and Settings\Can I\Pulpit\asp.net\sdfna\App_Code\dao\AccessBookDAO.vb 7 20 C:\...\sdfna\
Error 3 Class 'AccessBookDAO' must implement 'Function findById(id As Integer) As model.Book' for interface 'BookDAO'. C:\Documents and Settings\Can I\Pulpit\asp.net\sdfna\App_Code\dao\AccessBookDAO.vb 7 20 C:\...\sdfna\
for me the code looks correct, but I'm probably making some stupid mistake, as I've never been writing in VB before