面向对象编程中的消息传递 [英] Message Passing in Object oriented programming
本文介绍了面向对象编程中的消息传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
外面有人可以告诉我消息传递和方法调用之间有什么区别.
Can someone out there please tell me what is the difference between message passing and method invocation.
推荐答案
尝试阅读一下可能对您有所帮助
^ ]
Try read this may help you
http://msdn.microsoft.com/en-us/library/ms173114%28v=vs.80%29.aspx[^]
方法调用是当您调用方法
时 消息传递将对象作为参数(传递给方法)
Method Invocation is when you give a call to method
Message Passing is passing objects as parameters (to a method)
class A
{
public void Method(Object obj)
{
// Method does somthing
}
}
class B
{
Object obj1 = new Object();
A a = new A();
a.Method1(obj1);
}
在上面的示例中,a.Method1()是方法调用
将参数(obj1)传递给Method1是消息传递
In the above example a.Method1() is Method invocation
passing parameter (obj1) to Method1 is message passing
这篇关于面向对象编程中的消息传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文