⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m8.htm

📁 vb教程 vb教程 vb教程 vb教程 vb教程 vb教程 vb教程 vb教程 vb教程 vb教程 vb教程
💻 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关系(5)</font> </font> </font></div>
      </td>
    </tr>
    <tr valign=top> 
      <td class=H1 height=236> 
        <p align="left">   <font color="#000000">dr = d<br>
           &nbsp;End Sub<br>
           &nbsp;Public Sub Show()<br>
             &nbsp;MessageBox.Show("Engine: " + e.model)<br>
             &nbsp;dr.Show()<br>
           &nbsp;End Sub<br>
          End Class<br>
          '----------------------------------------------------<br>
          Public Class Form1<br>
           &nbsp;Inherits System.WinForms.Form<br>
           &nbsp;Public Sub New()<br>
             &nbsp;MyBase.New()<br>
             &nbsp;Form1 = Me<br>
             &nbsp;'This call is required by the Win Form Designer.<br>
             &nbsp;InitializeComponent()<br>
             &nbsp;'TODO: Add any initialization after the InitializeComponent() 
          call<br>
           &nbsp;End Sub<br>
           &nbsp;'Form overrides dispose to clean up the component list.<br>
           &nbsp;Public Overrides Sub Dispose()<br>
             &nbsp;MyBase.Dispose()<br>
             &nbsp;components.Dispose()<br>
           &nbsp;End Sub<br>
          #Region " Windows Form Designer generated code "<br>
           &nbsp;.......<br>
          #End Region<br>
           &nbsp;Protected Sub Form1_Click(ByVal sender As Object, ByVal 
          e As System.EventArgs)<br>
             &nbsp;Dim civic As New Car()<br>
             &nbsp;Dim d1 As New Driver("Wang")<br>
             &nbsp;Dim d2 As New Driver("Kao")<br>
             &nbsp;civic.assignTo(d1)<br>
             &nbsp;civic.Show()<br>
             &nbsp;civic.assignTo(d2)<br>
             &nbsp;civic.Show()<br>
           &nbsp;End Sub<br>
          End Class<br>
          <br>
          此程序输出﹕<br>
                &nbsp; Model: Honda<br>
                &nbsp; Driver: Wang<br>
                &nbsp; Model: Honda<br>
                &nbsp; Model" Kao<br>
          <br>
          Car之对象诞生后﹐也诞生Engine之对象e ﹔同时立即指定司机﹐如下指令﹕<br>
            &nbsp;<br>
             &nbsp;Dim civic As New Car()<br>
             &nbsp;Dim d1 As New Driver("Wang")<br>
               ..... <br>
             &nbsp;civic.assignTo(d1)<br>
               .....<br>
          <br>
          日常生活中的常见情况﹕汽车对象诞生时﹐不须立即指定司机对象。例如﹐汽车出厂时或闲置时并无司机﹐且汽车经常更换司机。此情形下﹐应先诞生civic对象和d1对象,如下:<br>
          <br>
          <br>
          <br>
          此时,未立即指定司机﹔而必要时才以assignTo()程序指定司机。例如,将d1指定给civic对象﹐就令civic内之参考变量dr指向d1 
          对象,如下: <br>
          </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 + -