Message Passing – Feature of Object Oriented Programming (OOP)

Download our Android App from Google Play Store and start reading Reference Notes Offline.

message passingMessage Passing – Characteristics of Object Oriented Programming
Object Oriented Programming(OOP)
Third Semester | Second year
BSc.CSIT | Tribhuvan University (TU)

Message Passing
In object oriented languages, you can consider a running program under execution as a pool of objects where objects are created for ‘interaction’ and later destroyed when their job is over. This interaction is based on ‘messages’ which are sent from one object to another asking the recipient object to apply one of its own methods on itself and hence, forcing a change in its state. The objects are made to communicate or interact with each other with the help of a mechanism called message passing. The methods of any object may communicate with each other by sending and receiving messages in order to change the state the object. An object may communicate with other objects by sending and receiving messages to and from their methods in order to change either its own state or the state of other objects taking part in this communication or that of both. An object can both send and receive messages.

The messages are send and received by passing various variables among specific methods using the signature ( a term that is not prevalent in common parlance) of the methods. Every methods has a well defined and structured signature. The signature of a method is composed of (1) a type, associated with the variable whose value after execution of the method, would be returned to the object that would invoke the method; (2) the types of a specific number of variables and the order associated with these variables whose values would be passed to the method before execution of the method starts. All these variables have a well defined format and corresponding values at any instant of time available for communication during the execution of the program. Figure below shows an example of a signature for a method ‘evaluate’.

signature of a method

(Visited 966 times, 1 visits today)

Posted By : Digvijay | Comment RSS | Category : Third Semester
Tag : ,

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Wordpress DMCA
Community | Toolbar | Android App | Founder/Developer : Hari Prasad Chaudhary | CSIT Portal Manager : Digvijay Chaudhary