Posts

Most Popular OOP languages

Every Programming methodology emphasizes on some new concepts in programming. In oop programming, the attention is focused on objets, In thes, data do not flow around a system; it is the messages that move around the system. By sending messages, the clients request objects to perform operations. The kinds of services the objects can provide are known to the clients. This, basically, represents the client-server model, where the client calls on a server, which performs some service and sends the result back to the client. The client must know the interface of the server , but the server need not know the interfaces of the clients, because all the interactions are initiated by clients using the server's interface. * Pure Object-Oriented Languages ** Object-Based languages  Other are extended conventional languages

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.

Polymorphism ,operator overloading,function overloading,dynamic binding

In the real world, the meaning of an operation varies with context and the same operation may behave differently, in different situation. The move operation, for example, behaves differently on the class person, and on the class polygon on the screen. A specific implementation of an operation by a certain class is called a method. A object oriented operation, being polymorphic, may have more than one method of implementing it. The word polymorphism is derived form the Greek meaning many forms. It allows a single name to be used for more than one related purpose, which are technically different. The following are the different ways of achieving polymorphism in a C++ program. Function Name Overloading  Operator overloading  Dynamic Binding Polymorphism permits the programmer to generate high level reusable component that can be tailored to fit different applications, by changing their low level parts,. Dynamic Binding  binding refers to the tie-up of a procedure call to

Encapsulation and Data Abstraction In OOP

Image
Encapsulation is a mechanism that associates the code and the data it manipulates and keeps them safe from external interference and misuse. Creating new data types using encapsulated-Items that are well suited to an application to be programmed is known as data abstraction. The data types created by the data abstraction process are known as Abstraction process are known as Abstract Data Types. Data abstraction is a powerful technique, and its proper usage will result optimal, more readable, and flexible programs. Fig. An Abstract Data type The use of encapsulation in protecting the members of a class from unauthorized access is a good programming practice; it enforces the separation between the specification and implementation of abstract data types, and it enables the debugging of programs easily.

Reusability In OOP

Image
  In OOP, The concept of inheritance provide the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes. The real appeal and power of the inheritance mechanism is that it allows the programmer to reuse a class that is almost, but not exactly, what he wants, and to tailor the class in such a way that it does not introduce any undesirable side effects into the rest of the classes.  Fig.5 : Property inheritance Note that each sub class defines only those features that are unique to it. Without the use of classification, each class would have to explicitly include all of its features.

Inheritance in OOP

    Inheritance is the process by which object of one class acquire the properties of objects of another class. It supports the concept of hierarchical classification. For example, the bird 'robin' is a part of the class flying bird which is a part of the class flying bird which is again a part of the class bird. The principle behind this sort of division is that each derived class shares common characteristics which class from which it is derived as ie. in Fig. 5.

Class

We just mentioned that objects contain data, and code to manipulate that data. The entire set of data and code of an object can be made a user- defined data type with the help of a class, in fact, objects are variables of the type class. Once a class has been defined, we can created any number of objects belonging to that class. Each object is associated with the data of types class with the data of type class with which they are created. A class id=s thus a collection of objects of similar type,  For example,  mango, apple and orange are members of the class fruit. Classes are user-defined data types and behave like the built-in types of a programming language, The syntax used to create an object is no different then the syntax used to create an integer object in C. If fruit has been defined as class, then the statement     Fruit mango;   will create an object mango belonging to the class fruit.