Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

beginner
templates

What is Object-Oriented Programming?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

An “Object” is the key component of Object-oriented programming. An Object may contain data (fields or variables) or code (methods or procedures). The creation of these objects is based on a programmer-defined blue-print also known as a Class.

Classes are like ideas. Objects are concrete manifestations of those ideas.

An example of classes

svg viewer

Java is an example of an Object-oriented programming (OOP) language.

The four basic principles of OOP

svg viewer

1) Inheritance

Inheritance is the process of creating new classes, called derived classes, from base classes where an “is-a” relationship exists. The derived class extends from the base class in order to inherit its properties.

2) Polymorphism

Polymorphism is the ability of an object to take on many forms. For example, square, rectangle, circle and triangle classes can have the same parent class Shapes, but each class can have its own method named drawShape().