VBHuguenot
Member
- Joined
- Aug 8, 2007
- Messages
- 12
- Programming Experience
- 1-3
I have read 3 books on interfaces. Studied 6 web sites on interfaces. Read posts in this forum on interfaces and I am still not getting it. I am a very intelligent person, but for some reason interfaces to me are like ...well?... Interfaces.
Here is an example to get someone started to build on for my feeble interfaced mind. Thanks....
OK, so here is what I totally don't get. What is the use of using the "MyInterface" in class three? I can type in code within the "tellTime" method in class3. But lets say I need the same thing in class 2? Then I would have to redundantly type the same code in class 2? so it would look like this:
Which in turn would look exactly like class 3:
So why not just do this?
I just dont get it? I hear that you use it for multiple inheritance, but I dont see the inheriting anywhere? Please help I am running out of money purchasing books!!!
Here is an example to get someone started to build on for my feeble interfaced mind. Thanks....
VB.NET:
Public class Class2
MessageBox.Show("Class 1 Time is: " & DateTime.Now)
End Class
Public class Class2
MessageBox.Show("Class 2 Time is: " & DateTime.Now)
End Class
Public class Class3
Implements MyInterface
Public Sub tellTime() Implements MyInterface.tellTime
End Sub
End Class
Public Interface MyInterface
sub tellTime()
End Interface
OK, so here is what I totally don't get. What is the use of using the "MyInterface" in class three? I can type in code within the "tellTime" method in class3. But lets say I need the same thing in class 2? Then I would have to redundantly type the same code in class 2? so it would look like this:
VB.NET:
Public class Class2
Implements MyInterface
Public Sub tellTime() Implements MyInterface.tellTime
....
End Sub
End Class
Which in turn would look exactly like class 3:
VB.NET:
Public class Class2
Implements MyInterface
Public Sub tellTime() Implements MyInterface.tellTime
....
End Sub
End Class
So why not just do this?
VB.NET:
Public class Class2
Public Sub tellTime()
....
End Sub
End Class
Public class Class3
Public Sub tellTime()
....
End Sub
End Class
I just dont get it? I hear that you use it for multiple inheritance, but I dont see the inheriting anywhere? Please help I am running out of money purchasing books!!!