|
-
Nov 18th, 2003, 01:10 AM
#1
Thread Starter
Frenzied Member
Interfaces and methods..
I have a question... If I declare a datareader and give it some data
dim rdr as OleDBDataReader = mycommand.executereader()
if I then create a new customer class
dim mycustomer as new Customer(rdr)
and the customer is declared like this
public class Customer()
public sub new(byval rdr as IDataReader)
'do something
end sub
end class
whats the point of using an Interface as a parameter? Why not just pass the datareader object itself? After all, I have already set it to oledbdatareader, so the purpose of using the interface is already defeated, yes?
As I see it, it could be useful to use the interface if I had no clue what kind of datareader I was talking to... then an iterface is handy. But now I could just go along with the oledbdatareader itself...and forget about the interface
Can anyone clarifyif why an interface is used in this case, and give some further information about the whole subject...
thanks
Henrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|