General Concept of OOP: Basic Concepts: Objects, Classes and Data Abstraction

Doorsteptutor material for IAS/Mains General-Studies-III is prepared by world's top subject experts: fully solved questions with step-by-step explanation- practice your way to success.

Download PDF of This Page (Size: 150K)

Basic Concepts

The following are the basic concepts used in object-oriented programming.

Image of Basic Concepts

Image of Basic Concepts

Objects

Image of Object

Image of Object

  • It can represent a person, a bank account or any item that a program can handle

  • When a program is executed, the objects interact by sending messages to one another.

For example, if ‘customer’ and ‘account’ are two objects in a program, then the customer object may send message to account object requesting for a bank balance.

  • Each object contains data and code to manipulate data.

  • Objects can interact without having to know details of each other’s data or code

  • It is sufficient to know the type of massage accepted and the type of response returned by the objects.

Classes

Image of Classes

Image of Classes

  • We have just mentioned that objects contain data and function or 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.

  • Once a class has been defined, we can create any number of objects associated with that class. For example, mango, apple and orange are members of class fruit.

  • If fruit has been defined as a class, then the statement fruit mango, will create an object mango belonging to the class fruit.

Data Abstraction

Image of Abstraction

Image of Abstraction

  • Abstraction refers to the act of representing essential features without including the background details.

  • To understand this concept more clearly, take an example of 'switch board'. You only press particular switches as per your requirement. You need not know the internal working of these switches.

  • This is abstraction, where you only know the essential things to operate on switch board without knowing the background details of switch board.

Developed by: