NCERT Computer: Chapter 8 – General Concept of OOP Part 2

Download PDF of This Page (Size: 230K)

4 Basic Concepts

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

1. Objects

  • 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.

2. 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.

3. Data 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.