📄 m5.htm
字号:
<html>
<head>
<title>VB教程</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<p align="center"><script src="../../1.js"></script></a>
<body bgcolor="#ffffff" leftmargin="5" topmargin="1" marginheight="5" marginwidth="5">
<div align=center>
<table border=0 cellpadding=0 cellspacing=0 width=680 align="center">
<tbody>
<tr>
<td bgcolor=#000000 height=14>
<div align=center class=H1> <font color="#FFFFFF">VB.Net中文教程(13) Whole-Part关系(2)</font> </font> </font></div>
</td>
</tr>
<tr valign=top>
<td class=H1 height=236>
<p align="left"> <font color="#000000">Inherits System.WinForms.Form<br>
<br>
Public Sub New()<br>
MyBase.New()<br>
<br>
Form1 = Me<br>
'This call is required by the Win Form Designer.<br>
InitializeComponent()<br>
'TODO: Add any initialization after the InitializeComponent()
call<br>
End Sub<br>
'Form overrides dispose to clean up the component list.<br>
Public Overrides Sub Dispose()<br>
MyBase.Dispose()<br>
components.Dispose()<br>
End Sub<br>
#Region " Windows Form Designer generated code "<br>
......<br>
#End Region<br>
Protected Sub Form1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)<br>
Dim x(2) As Club<br>
x(0) = New Club("sogo")<br>
x(1) = New Club("gold")<br>
Dim a As New Person("Alvin", 32)<br>
Dim b As New Person("Judy", 28)<br>
Dim c As New Person("Bob", 38)<br>
x(0).join(a)<br>
x(0).join(b)<br>
x(1).join(b)<br>
x(1).join(c)<br>
x(0).display()<br>
x(1).display()<br>
End Sub<br>
End Class<br>
<br>
此程序输出:<br>
<br>
Club: sogo has member:<br>
Alvin, 32<br>
Judy, 28<br>
Club: gold has member:<br>
Judy, 28<br>
Bob, 38<br>
<br>
组合对象x 含"sogo"及"gold"两俱乐部﹐其中"gold"俱乐部拥有两个会员──"Alvin" 及"Judy"﹐而"sogo"俱乐部拥有两位会员──"Judy"及"Bob"
。x(0)代表"sogo"俱乐部﹐s(1)代表"gold"俱乐部﹐所以指令── s(0).join( a ) 表示a 加入"gold"俱乐部﹐成为其会员。
</font> </span> <br>
</p>
</td>
</tr>
</table>
</div>
<p align="center"><a href="../../pian/vb.htm">回首页</a>
<p align="center"><script src="../../2.js"></script></a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -