What Is Basic Concepts Of Object-Oriented Programming?
1.Object and Class:-
- Objects are the basic runtime entities in an object-oriented system.
- They may represent a person,a place,a bank account , a table of data or any item that the program may handle.
- They may also represent user-defined data such as vectors and lists.
- Any programming is analyzed in terms of objects and the nature of communication between them.
- Program objects should be chosen such that they match closely with the real world objects.
- As pointed out earlier , an object takes up space in the memory and has an associated address like a record in Pascal, or a structure in C.
- When a program is executed the objects interact by sending message to one another.
2.Data Abstraction and Encapsulation:-
- The wrapping up of data and methods into a single unit(called class) is known as encapsulation.
- Data encapsulation is the most striking feature of a class.
- The data is not accessible to the outside world and only those methods,which are wrapped in the class, can access it.
- These methods provide the interface between the object's data and the program.
- This insulation of the data from direct access by the program is called data hiding.
- Encapsulation makes it possible for objects to be treated like 'black boxes', each performing a specific task without any concern for internal implementation.
- 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 cost, and methods that operate on these attributes.
- They encapsulate all the essential properties of the objects that are to be created.
- Encapsulation is one of the three OOP principle.
- Inheritance is the process by which objects of one class acquire the properties of objects of another class.
- Inheritance support the concept oh hierarchical classification .
- For example, the bird robin is a part of the class flying bird,which is again a part of the class bird.
- In java , the derived class is known as 'subclass'.
- Note that each subclass defines only those feature that are unique to it.
- Without the use of inheritance ,each class would have to explicitly include all of its features.
- Polymerphism is another important OOP concept.
- .
- Polymerphism means the ability to take more than one form.
- For example ,an operation may exhibit different behavior in different instance.
- The behavior depends upon the types of data used in the operation.
- Polymerphism play an important role in allowing objects having different internal structures to share the same manner even though specific actions associated with each operation may differ.
- Polymerphism is extensively used in implementing inheritance.
Comments
Post a Comment