Accepted solution писал(а):This doesn't look like inheritance any longer. Instead you implement methods (but then you don't, because you attempt to call the void definitions of the base classes).
I'm really learning here, so don't take anything for granted.
How to use inheritance in Visual Basic 2005 or in Visual Basic .NET
http://support.microsoft.com/kb/307222
MIT писал(а):Accepted solution писал(а):This doesn't look like inheritance any longer. Instead you implement methods (but then you don't, because you attempt to call the void definitions of the base classes).
I'm really learning here, so don't take anything for granted.
How to use inheritance in Visual Basic 2005 or in Visual Basic .NET
http://support.microsoft.com/kb/307222
Public Interface Interface1
Function Text() As String
End Interface
<Microsoft.VisualBasic.ComClass()> Public Class Class1
Implements Interface1
Public Function Text() As String Implements Interface1.Text
Return "some text"
End Function
End Class
<Microsoft.VisualBasic.ComClass()> Public Class Class2
Inherits Class1
End Class
Классу "Class2" назначен Microsoft.VisualBasic.ComClassAttribute, однако "Class2" не имеет открытых членов, которые могут быть использованы через COM, поэтому COM-интерфейсы не созданы.
Public Interface Interface1
Function Text() As String
End Interface
<Microsoft.VisualBasic.ComClass()> Public Class Class1
Implements Interface1
Public Function Text() As String Implements Interface1.Text
Return "some text"
End Function
End Class
<Microsoft.VisualBasic.ComClass()> Public Class Class2
Inherits Class1
Implements Interface1
Public Overloads Function Text() As String
Return "someelse text"
End Function
End Class
drronnie писал(а):но это не удобно.
Public Interface Interface1
Function Text() As String
End Interface
<Microsoft.VisualBasic.ComClass()> Public Class Class1
Implements Interface1
Public Function Text() As String Implements Interface1.Text
Return "some text"
End Function
End Class
<Microsoft.VisualBasic.ComClass()> Public Class Class2
Inherits Class1
Implements Interface1
Public Overloads Function Text() As String
Return MyBase.Text
End Function
End Class
<Microsoft.VisualBasic.ComClass()> Public Class Class1
Public Overridable Function Text() As String
Return "some text"
End Function
End Class
<Microsoft.VisualBasic.ComClass()> Public Class Class2
Inherits Class1
Public Overrides Function Text() As String
Return MyBase.Text
End Function
End Class
drronnie писал(а):По-моему правильнее будет переопределить функцию Text в производном классе
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 85