MESSAGE PASSING


                     PREVIOUS                                                                                                          NEXT

Message Passing refers to that establishing communication between one place to another.Message Passing is nothing but sending and receving of information by the objects same as people exchange information. So this helps in building systems that simulate real life. Following are the basic steps in message passing:-

  • Creating classes that define objects and its behaviour.
  • Creating objects from class definitions.
  • Establishing communication among objects.

In OOPs, Message Passing involves specifying the name of objects, the name of the function, and the information to be sent.

Programming languages like Smalltalk and Objective-C are considered more flexible than C++ because they support dynamic message passing. C++ does not support dynamic message passing; it only supports static message passing: when a method of an object is invoked, the target object must have the invoked method; otherwise, the compiler outputs an error.

Although the way C++ does message passing is much faster than the way Smalltalk or Objective-C does it, sometimes the flexibility of Smalltalk or Objective-C is required.C++ achieves message passing with the help of vtables.Smalltalk and Objective C use a method map to achieve the same result.

The message passing is shown below:


object. method (parameters);








Powered by Blog - Widget
Face Upward - Widget