Prev | Current Page 180 | Next

Guy Fouch?©, Trey Nash

"Accelerated VB 2008"


CHAPTER 6 n INTERFACES 100
Interface Inheritance
As mentioned previously, interfaces support inheritance from multiple interfaces in the syntactic
sense, such as in the following code:
Public Interface IEditBox
Sub Edit()
End Interface
Public Interface IDropList
Sub DropDown()
End Interface
Public Interface IUIControl
Inherits IEditBox, IDropList
Sub Paint()
End Interface
Public Class ComboBox
Implements IUIControl
Sub Edit() Implements IUIControl.Edit
'Edit
End Sub
Sub DropDown() Implements IUIControl.DropDown
'Drop down
End Sub
Sub Paint() Implements IUIControl.Paint
'Paint
End Sub
End Class
In the previous example, IUIControl inherits from two interfaces, IEditBox and IDropList.
The ComboBox class, though it explicitly declares that it implements only IUIControl, must also
implement all the methods of the interfaces that IUIControl inherits.
Implementing Multiple Interfaces
Classes can also implement multiple interfaces, as in the following example:
Public Interface IUIControl
Sub Paint()
End Interface
Public Interface IEditBox
Inherits IUIControl
CHAPTER 6 n INTERFACES 101
Sub Edit()
End Interface
Public Interface IDropList
Inherits IUIControl
Sub DropDown()
End Interface
Public Class ComboBox
Implements IEditBox, IDropList
Sub Edit() Implements IEditBox.


Pages:
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
szkoła narciarska wyrejestrowanie samochodu legnica obciążniki Wczasy nad morzem serwis drukarek katowice