我对VB.net相当陌生,我无法编译此代码,也无法理解为什么。
MustInherit Class Poligono
Protected p_cant_Lados As Integer
Public Property cant_Lados() As Integer
Get
Return p_cant_Lados
End Get
Set(ByVal value As Integer)
p_cant_Lados = value
End Set
End Property
Public MustOverride Function obtenerPerimetro()
Public MustOverride Function cargarLados()
End Class
Public Class Triangulo
Inherits Poligono
Private lado1 As Integer
Private lado2 As Integer
Private lado3 As Integer
Public Function cargarLados() As Object
Return 1
End Function
Public Function obtenerPerimetro() As Object
Return 1
End Function
End Class
错误2'Triangulo'无法从类'Poligono'继承,因为它扩展了基类对程序集的访问。c:\ users \ win7 \ documents \ visual studio 2013 \ Projects \ WindowsApplication1 \ WindowsApplication1 \ Form1.vb 33 14 WindowsApplication1
谢谢!
默认情况下,在名称空间级别声明的类将获得Friend
访问级别。所以Poligono
是Friend Class
。一Friend
类可能不可见向一般公众。
更改
MustInherit Class Poligono
至
Public MustInherit Class Poligono
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句