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

📄 200603090938465.html

📁 软件工程的红包书
💻 HTML
字号:
<html>
<head><title>消息</title></head>
<center><h1>消息</h1></center>
<div><P align=right><FONT face=Verdana><FONT face=Verdana><FONT color=#f70938><FONT face=黑体><a href="200604112229525.html" tppabs="http://www.itisedu.com/phrase/200604112229525.html" target="_new">中科永联</a>高级技术培训中心(</FONT><FONT face=黑体>www.itisedu.com</FONT><FONT face=黑体>)<IMG src="2006327214658953.jpg" tppabs="http://www.itisedu.com/manage/Upload/image/2006327214658953.jpg" border=0></FONT></FONT></FONT></FONT></P>
<P><FONT face=Verdana>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="200603090938465.html" tppabs="http://www.itisedu.com/phrase/200603090938465.html" target="_new">消息</a>,<a href="200604232134205.html" tppabs="http://www.itisedu.com/phrase/200604232134205.html" target="_new">软件</a><a href="200603090845215.html" tppabs="http://www.itisedu.com/phrase/200603090845215.html" target="_new">对象</a>之间进行交互作用和通讯是利用消息的。</FONT></P>
<P><FONT face=Verdana>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 单一的一个对象通常不是很有用的。相反,一个对象通常是一个包含了许多其它对象的更大的<a href="200604232224305.html" tppabs="http://www.itisedu.com/phrase/200604232224305.html" target="_new">程序</a>或者应用程序。通过这些对象的交互作用,程序员可以获得高阶的功能以及更为复杂的行为。你的自行车如果不使用它的时候,它就是一堆铝合金和橡胶,它没有任何的活动。而只有当有其它的对象来和它交互的时候才是有用的。</FONT></P>
<P><FONT face=Verdana>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 软件对象与其它对象进行交互与通讯是利用发送给其它对象来实现的。当对象A想对象B来执行一个B中的方法,对象A就会消息给对象B。如图1所示。</FONT></P>
<P><FONT face=Verdana></FONT></P>
<P align=center><FONT face=Verdana><IMG src="2006327214716180.gif" tppabs="http://www.itisedu.com/manage/Upload/image/2006327214716180.gif" border=0></FONT></P>
<P align=center><FONT face=Verdana>(图1)</FONT></P>
<P><FONT face=Verdana>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 有时候,接收的对象需要更多的信息就至于它可以正确知道该如何做。比如,当你想改变自行车的齿轮,你就必须指出哪个齿轮。这个信息是将信息作为参数来传递的。如图2所示的现实了一个信息由三个<a href="200603302222545.html" tppabs="http://www.itisedu.com/phrase/200603302222545.html" target="_new">组件</a>组成:</FONT></P>
<P><FONT face=Verdana>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 被寻址消息的对象(YourBicycle) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 要执行方法的名字(changeGears) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这个方法需要的所有参数(lowerGear) </FONT></P>
<P><FONT face=Verdana></FONT></P>
<P align=center><FONT face=Verdana><IMG src="2006327214728408.gif" tppabs="http://www.itisedu.com/manage/Upload/image/2006327214728408.gif" border=0></FONT></P>
<P align=center><FONT face=Verdana>(图2)</FONT></P><FONT face=Verdana>
<P><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 上面的三个组件对于接收方的对象执行相应的方法是给出了充分的信息。再也不需要其它的信息或者上下文了。</P>
<P><STRONG>消息提供了两个重要的好处</STRONG></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对象的行为是通过它的方法来表达的,因此消息传递支持所有在对象之间的可能的交互。 </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对象不需要在相同的进程或者相同的机器上来发送和接收消息给其它的对象。</FONT></P></div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -