1. 新建一个module,设置public 其他类才可以调用

Public Module Module2
Public Interface MyInterface
Property stuName As String
Function GetScore(ByVal x As Single) As Single
End Interface Public Class StuInfo
Implements MyInterface
Private studentScore As Single
Private studentName As String
Public Property Score() As Single
Get
Return studentScore
End Get
Set(ByVal value As Single)
studentScore = value
End Set
End Property
Public Function GetScore(ByVal x As Single) As Single Implements MyInterface.GetScore
Return x * 0.8
End Function Public Property StuName() As String Implements MyInterface.stuName
Get
Return studentName
End Get
Set(ByVal value As String)
studentName = value
End Set
End Property
End Class Public Class StuMessage
Implements MyInterface
Private studentName As String
Private stuScore As Single
Public Property Score() As Single
Get
Return stuScore
End Get
Set(ByVal value As Single)
stuScore = value
End Set
End Property
Public Function GetScore(ByVal x As Single) As Single Implements MyInterface.GetScore
Return x * 0.8
End Function Public Property StuName() As String Implements MyInterface.stuName
Get
Return studentName
End Get
Set(ByVal value As String)
studentName = value
End Set
End Property End Class End Module

2. 测试页面:

Public Class TestClassForm
Public Sub ShowScore(ByVal obj As MyInterface, ByVal s As String, ByVal score As Single)
MsgBox(s & "成绩为:" & obj.GetScore(score) & "")
End Sub
Private Sub TestClassForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim obj1 As New StuInfo()
Dim obj2 As New StuMessage()
ShowScore(obj1, "期中", )
ShowScore(obj2, "期末", )
End Sub
End Class

最新文章

  1. [Web API] Web API 2 深入系列(4) Action的选择
  2. Loadrunner之API测试
  3. winform建立非矩形窗体
  4. jQuery document window load ready 区别详解
  5. 11.Warning (332060): Node: pi_fck3p was determined to be a clock but was found without an associated clock assignment.
  6. Web网站压力测试工具
  7. c#委托把方法当成参数
  8. WPF textbox 圆角制作
  9. 网页嵌入百度地图和使用百度地图api自定义地图的详细步骤
  10. 递归——CPS(一)
  11. Ubuntu下php网站运行环境搭建
  12. Serv-U FTP版本控制服务器 - 目录规范
  13. Expected MultipartHttpServletRequest: is a MultipartResolver configured解决方案
  14. Spring MVC的DispatcherServlet
  15. nginx实现https网站设置
  16. Nginx (LNMP+https)
  17. request.getParameter(“xxx”)的参数的取值
  18. hdu 1013 过山车 匈牙利算法(代码+详细注释)
  19. Thinkphp分页类使用
  20. vi规范

热门文章

  1. php多版本使用composer
  2. ASP.NET + MVC5 入门完整教程七 -—-- MVC基本工具(下)
  3. css各类选择器类型和用法
  4. 【转】Java8 Stream 流详解
  5. Android开发实战——记账本(2)
  6. webpack4.41.0配置四(热替换)
  7. VS调试工具
  8. KM算法模板 hdu 2255
  9. Bug搬运工-Forerunner CRC error on 54SG/53SG3 triggers watchdog timeout crash
  10. [远古回忆]发现了以前的一些wow截图 这里也备份一下