A)
->in an object oriented system objects communicate one another through message passing.
->in implementation of message passing the fallowing things are involved
1) message sender (object)
2) message receiver (object)
3) message (method)
->Calling method belongs to which object that object is the message sender. Called method belongs to the object. That object is the message receiver.
->One object calling a method from another object is nothing but the first object is sending a message to the second object.
Ex:
class A
{
void x()
{
B b=new B();
b.y();//message passing
}
}
class B
{
void y()
{
}
}
->in the above example, object of class A is the message sender and the object of class B is the message receiver. Method call y is nothing but message passing.
->whenever one object needs the service of another object it communicates with that object using message passing.
->message sender object is service request object and message receiver object is the service provider object.
Comments
Post a Comment