Click to See Complete Forum and Search --> : IList-How can I use this interface
gregory82gr
January 4th, 2006, 04:15 AM
I dont Know how can I use Interface In General.
Please if someone can to send me some simple example
with e.g IList.Add or something else
jhammer
January 4th, 2006, 05:01 AM
You are not supposed to work with IList interface (uless you really have to).
Inherit from CollectionBase instead, or implement ICollection.
Interfaces in general define a contract that a class which inmplements that interface has to follow: The implementing class must implement all methods, properties and events that are in the interface.
Example:
Public Interface MyInterface
Event E()
Sub F(ByVal Value As Integer)
Property P() As String
End Interface
Public Class MyClass
Implements MyInterface
(...) ' Must implement E,F,P
End Class
aniskhan
January 4th, 2006, 02:43 PM
The Interface
public interface face
sub eye(..)
property weep(..) as integer
end interface
2 class implementing the interface
Class1
public class c1
implements face
sub eye(..) implements face.eye
....
end sub
public property weep() as integer implements face.weep
get
...
end get
set(byval a as integer)
...
end set
end property
end class
Class2
public class c2
implements face
sub eye(..)as integer implements face.eye
....
end sub
public property weep() as integer implements face.weep
get
...
end get
set(byval a as integer)
...
end set
end property
end class
testing the interface
private sub form1_load(......
dim c1_1 as new c1
c1_1.weep=12
c1_1.eye(3)
dim c2_1 as new c2
c2_1.weep=4
c2_1.eye(2)
end sub
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.