inheritancec.vb

来自「大名鼎鼎的mono是.NET平台的跨平台(支持linux」· VB 代码 · 共 26 行

VB
26
字号
Option Strict Off'Testing access to protected members of a class from it's derived classClass C1    Protected a As Integer    Protected Function S()        a = 47    End FunctionEnd ClassClass C2    Inherits C1    Public Function F() As Integer        S()        Return a    End FunctionEnd ClassModule Inheritence    Function Main() As Integer        Dim myC As Object = New C2()        Dim b As Integer = myC.F()        If b <> 47 Then            System.Console.WriteLine("InheritenceF:Failed-Error in accessing protected member from a derived class") : Return 1        End If    End FunctionEnd Module

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?