菜鸟求解!!!
- VB.NET code
Public Class TestFrm Implements ITest Public Sub Main() Dim t As New TestClass t.Main() End Sub Private _strPrint As String = "TestData" Private Property aaaa As String Implements ITest.strPrint Get Return _strPrint End Get Set(value As String) _strPrint = value End Set End PropertyEnd ClassPublic Class TestClass Public Sub Main() Dim f As New TestFrm Dim t As ITest = f Debug.Print(t.strPrint) End SubEnd ClassPublic Interface ITest Property strPrint As StringEnd Interface
这就是面向接口编程吗????
[解决办法]
用的这么牵强!!
[解决办法]
不大清楚。
aaaa改为:strPrint。名称要相同。
Interface ITest里面可以 属性,方法,过程,函数。
Implements类必须和ITest名称一一对应,并实现。