有人可以解释什么MustOverride没有,但为什么使用它?它是揭露这个功能吗?有人可以解释MustOverride吗?
我有两个类,第一个(RoomFactory);
Public MustInherit Class RoomFactory : Inherits baseFactory
Private _roomid As Integer = 0
Private _roomname as String = ""
Public Sub New()
End Sub
Public Sub New(ByVal roomid As Integer, ByVal roomname As String)
Me.RoomId = roomid
Me.RoomName = roomname
End Sub
Public MustOverride Function CreateRoom(ByVal roomdetails As RoomFactory) As Integer
Public MustOverride Function IsRoomAvailable(ByVal roomdetails as RoomFactory) As Boolean
// .. properties removed for brevity .. //
二等(室)
Public Class Room : Inherits RoomFactory
Public Function CreateRoom(ByVal roomdetails As RoomFactory) As Integer
Return 0
End Function
Public Function IsRoomAvailable(ByVal roomdetails As RoomFactory) As Boolean
Return False
End Function
End Class
首先,我认为这是正确的,但想任何建议,否则 - 性能等,但我想主要的问题是 - 为什么要使用MustOverride?
请原谅我在这里无知。
谢谢托尼,基本上是揭示基类中的函数(普通功能) - 推动它。这至少是我的理解,似乎是这样。非常感谢。 感谢您对工厂情况的提示。我对界面并不熟悉,但我会走开并做一些阅读,看看我能弄清楚什么。 再次感谢。 – dooburt 2009-11-06 11:13:36