- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is object-oriented programming (OOP)?
45 Lectures 4.5 hours
66 Lectures 5.5 hours
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. For example, a person is an object which has certain properties such as height, gender, age, etc. It also has certain methods such as move, talk, and so on.
This is the basic unit of object-oriented programming. That is both data and function that operate on data are bundled as a unit called an object.
When you define a class, you define a blueprint for an object. This doesn't actually define any data, but it does define what the class name means, that is, what an object of the class will consist of and what operations can be performed on such an object.
OOP has four basic concepts on which it is totally based. Let's have a look at them individually −
- Abstraction − It refers to, providing only essential information to the outside world and hiding their background details. For example, a web server hides how it processes data it receives, the end user just hits the endpoints and gets the data back.
- Encapsulation − Encapsulation is a process of binding data members (variables, properties) and member functions (methods) into a single unit. It is also a way of restricting access to certain properties or component. The best example for encapsulation is a class.
- Inheritance − The ability to create a new class from an existing class is called Inheritance. Using inheritance, we can create a Child class from a Parent class such that it inherits the properties and methods of the parent class and can have its own additional properties and methods. For example, if we have a class Vehicle that has properties like Color, Price, etc, we can create 2 classes like Bike and Car from it that have those 2 properties and additional properties that are specialized for them like a car has numberOfWindows while a bike cannot. Same is applicable to methods.
- Polymorphism − The word polymorphism means having many forms. Typically, polymorphism occurs when there is a hierarchy of classes and they are related by inheritance. C++ polymorphism means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function.
- What is the difference between Object oriented programming and Object based programming?
- What is Data Hiding in Python Object Oriented Programming?
- What are basic Object oriented programming concepts?
- Object Oriented Programming in Python?
- Object Oriented language v/s Procedure oriented programming language.
- Differences between Procedural and Object Oriented Programming.
- Object Oriented language v/s Object based programming language.
- Why Java is not a pure object oriented programming language?
- How to start object-oriented programming in C++?
- Basic Concepts of Object Oriented Programming using C++
- What does the repr() function do in Python Object Oriented Programming?
- What does the str() function do in Python Object Oriented Programming?
- What does the cmp() function do in Python Object Oriented Programming?
- Is Python Object Oriented or Procedural?