Message Communication in OOP

In conventional programming languages, a function is invoked on a piece of data whereas in an object-oriented language, a message is sent to an object. Hence, conventional programming is based on functional abstraction whereas, object oriented programming is based on data abstraction. This is illustrated By a simple example of evaluating the square root of a number. In conventional function programming, the function sqrt(x) for different data types (x's type), will defined with different names, which takes a number as an input and returns its square root. 
  
 In object-oriented programming, the process of programming involves the following steps:
  • Create classes for defining objects and their behaviors.
  • Define the required objects.
  • Establish communication among object through massage passing.


Comments

Post a Comment

Popular posts from this blog

Reusability In OOP

Encapsulation and Data Abstraction In OOP

Polymorphism ,operator overloading,function overloading,dynamic binding