1. OBJECTS
Objects are the basic run time entities of an object
oriented programming system. They may
represent a person, a place, a bank account, a table of data of any item that
the program has to handle. A programming problem is analysed in terms of
objects and the nature of communication between them. Objects take up space in
the memory and have an associated address similar to what structures are in C.
When a program is executed the objects interact by sending
messages to one another .
For example :- If
"Customer" and "Bank Account" are two Objects in a
program, then the customer object sends a message to the account object
requesting for the bank balance.
Each object contains data, and code to manipulate the data.
Objects can interact without having to know the details of each other's data or
code. It is sufficient to know the type of message accepted and the type of
response recieved by the object.
2. CLASSES
We know that objects contain data, and the required code to manipulate the 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 create a number of objects belonging to that class. Each object is associated with the data of type class with which they are created.
A class is 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 type of a programming language.
If fruit has been defined as a class then the syntax for creating an object is
fruit mango;
//This will create an object mango belonging to the class fruit
3. DATA ABSTRACTION AND ENCAPSULATION
Wrapping up of data and functions into a single unit (known as class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to the outside classes, only those functions which are wrapped in the class can access the data. This insulation of the data from direct access by the program is called data hiding or information hiding.
Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight, and functions to operate these attributes. They encapsulate all the essential properties of the object that are to be created. The attributes are sometimes called data members because they hold information. The function that operate on these data are called methods or member functions.
Since classes use the concept of data abstraction they are known as Abstract Data Types (ADT).
4. INHERITANCE
Inheritance is the process by which objects 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 again part of the class 'bird'. The principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived.
In OOP, the concept of Inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. The real appeal and power of 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 usch a way that it does not introduce any undesirable side effects into the rest of the classes.
5. POLYMORPHISM
Polymorphism is another important concept of OOP. Polymorphism is a Greek term which means the ability to take more than one form. An operation may exhibit different behaviours in different instances. The behaviour depends upon the type of data used in the the operation. The process of making an operator to exhibit different behaviours in different instances is known as operator overloading.
Polymorphism plays an important role in allowing objects having different internal structures to share same external interface. This means that a general class of operation may be accessed in the same manner even though specific action associated with each operation may differ. Polymorphism is extensively used to implement inheritance.
6. DYNAMIC BINDING
Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding also known as late binding means that the code associated with a given procedure call is not known until the time of the call at run time. It is associated with polymorphism and inheritance. A function call assocaited with a polymorphic reference depends on the dynamic type of that reference.
For example the procedure "Answering" . By inheritance every object "Student" will have this procedure however individual algorithms for each class will have different answers for the same procedure.
7. MESSAGE PASSING
An object oriented program consists of a set of objects that communicate with each other. The process of programming in an OOP Language therefore involves the following basic steps :-
- Creating classes that define objects and their behaviour
- Creating objects from class definitions and
- Establishing communication between objects.
Objects communicate with one naother by sending and recieving information much the same way people pass messages to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate their real world counterparts.
The message for an object is a request for execution of a procedure, and therefore will invoke a function in the recieving object that generates the desired result. Message passing involves specifying the name of the object, the name of the funtion and the information to be sent.
APPLICATION OF OOP
- Real time systems
- Simulation and modelling
- Object Oriented databases
- Hypertext, hypermedia and expertext
- AI and expert systems
- Neural networks and parallel programming
- Decision support and office automation systems
- CIM/CAM/CAD systems.
Tommorow we will learn about the various Header files of C++ and the basic input/output commands and also write our first C++ Program so do visit again tommorow.
Thank for visiting the page.
No comments:
Post a Comment
Thank you for commenting.