请问有人能够解释一下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?请原谅我的无知。