🍼OOPS

Object Oriented Programming paradigm follows certain fundamental concepts called:

OOPs Concepts

Class 🏫 A class defines the attributes and behaviors common to all objects of a certain kind.

Think of a class like a blueprint to build something. It has all the needed tools and instructions.

Object 🤖 An instance of a class, allocates memory and uses the class properties.

When you use the blueprint to build a real thing, that's an object. Every thing you build is unique.

Inheritance ️‍️️‍🔗 When a new class is defined based on an existing class, it inherits all the parent class's attributes and methods. The child can add or modify these as needed.

Polymorphism️ ✌️

Ability to treat objects with different internal structures interchangeably by interacting with them through a common interface. Redefines inherited methods. One name, multiple forms:

  • Method Overloading 📝 Same name, different parameters.

  • Method Overriding 📝 Redefining inherited methods in child class.

Abstraction 📃

abstraction involves defining common properties and behaviors that are shared across multiple entities, while leaving out specifics. This is done through abstraction layers like classes, interfaces, modules, etc. Hiding internal details and showing essential info:

  • Abstract Classes 📃 Can have abstract and concrete methods.

  • Interfaces 📃️ Only abstract methods and static final variables.

Encapsulation 📦

Bundling code and data together into a single unit (class) that hides its internal details from other code. Only exposes necessities through methods. Binding data and functions within a class. It helps achieve:

  • Information Hiding 🤐

  • Loose Coupling ⚙️

  • Maintainability 🛠️

Last updated