You are on page 1of 3

Basic Concepts of Object-Oriented Programming

1. Classes 2. Objects 3. Data abstraction 4. Data encapsulation 5. Inheritance 6. Polymorphism 7. Dynamic Binding 8. Message Passing

Student
DATA Name DOB Marks . FUNCTIONS Total Average Display .

Classes The entire set of data and code can be made as a user-defined type with the help of a class. Once a class has been defined, we can create any number of objects belonging to that class. A class gives a structure of what an object of its type will have. For example, consider, to represent students mark details, we can form the class as: Objects Objects are basic run-time entities which represent a person, a place or any item that the program must handle. Programming problem is analyzed in terms of objects and the nature of communication in between them. In other terms, objects are the runtime entities of a class. For example, the object for Student class can be created as follows: Student st1; st1 is the runtime entity of Student and it will have the data members Name, DOB and marks and the functions Total, Average and Display can be used by st1 to calculate

the mark details present in st1. Data Abstraction & Encapsulation The wrapping up of data and functions into a single unit is called as encapsulation. The data is not accessible to the outside world and those functions which are wrapped in the class can access it. Abstraction refers to the act of representing essential features without including the explanations. Since the classes use the concept of data abstraction, they are known as Abstract Data Types. Inheritance Person Attributes: Name Age Gender Student Attributes: Marks Course Staff
DATA Department Designation

Inheritance is the process by which objects of one class acquire the properties of another class. For example, a student as well as a staff is a Person. Both have some common properties. Inheritance allows the programmer to reuse defined properties. Polymorphism Polymorphism means the ability to take more than one form. For example, consider the operation of addition. For two numbers, the operation will generate a sum. If the operands are strings, then the operation would produce a third string by concatenation. Dynamic Binding Binding refers to the linking of a procedure call to the code to be executed.

Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run-time. Message Communication Objects communicate with one another by sending and receiving information. A message for an object is a request for execution of a procedure. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent. Example: st1.Total (Name);

Object Message

Information

You might also like