有没有办法在不创建 object 实例的情况下访问 class 中的函数 (VB)?

Is there a way to access functions (VB) in a class without making an instance of the object?

我有三个 classes,CarAdd、Car 和 EntityObject。 CarAdd 调用 EntityObject 中的方法,但它不能立即访问它们。相反,它创建一个 Car 类型的 object 并使用它来调用方法。问题是 EntityObject 不能被实例化,那么 Car class 有没有办法在没有 object 的情况下调用 EntityObject 的方法?

我曾尝试将 'shared' 功能包含到方法 header 中,但由于该函数实现了某些功能,我无法成功完成此操作。

'This executes when a button is pressed on the UI. _mCar is an object of type 'Car
'In class CarAdd
Public Sub BeginEdit()
        If _mCar IsNot Nothing Then _mCar.BeginEdit()
    End Sub

'This is the code I added to try and make this work. Since EO is nothing, 'though, the if statement never executes.
'In class Car
Private EO As EntityObject
Public Sub BeginEdit()
        If EO IsNot Nothing Then
            Call EO.BeginEdit()
        End If
    End Sub

'This is the method that I want to execute
'In class EntityObject
Public Sub BeginEdit() Implements System.ComponentModel.IEditableObject.BeginEdit
        If Not _blnIsEditing Then
            _blnIsEditing = True
            _OriginalObject = TryCast(Me.MemberwiseClone(), EntityObject)
        End If
    End Sub

我曾希望方法调用实质上会流经 Car class 并到达 EntityObject class,但事实并非如此。相反,Car class 中的 if 语句永远不会执行,因此永远不会调用该方法。

不,如果 Sub/Function 不是 SharedBeginEdit 不是 EntityObject 中的 Shared)。根据定义,非 Shared SubFunction 是 instance-specific 并且只能通过实例使用。

更多关于 shared/non-shared class 成员 here