Monday, March 29, 2021

What is OOP (Object Oriented Programming)?

Object-Oriented Programming is about creating Objects out of Classes


What is a Class?

Class is nothing but a blue print or a template for an object. It contains the attributes and methods.

For example, Car is a class and Audi, Mercedes, Porche, Farrari are objects of it. 

What is an Object?

           An instantiation of the class creates and an Object. This helps to reduce the repetition of code.

For example, from above one Audi is an object created from a abstract Car class. 

Pillars of Object-Oriented Programming

  • Encapsulation

    • This means show only necessary to the outer world, achieved through Access Modifiers

  • Inheritance

    • Inheriting properties from a parent object makes it more reusable and extensible
    • Helps to remove redundant code

  • Polymorphism

    • Same method signature with various forms or taste
    • Dynamic Polymorphism
    • Static Polymorphism

  • Abstraction

    • This helps to hide the complexity in your code
    • Abstract classes and methods help to achieve multiple forms and are reusable in nature

Advantages of Object-Oriented Programming

  •  Reduce repetition of code
  •  Clear Code, Less Code
  •  Faster and manageable
  •  Easy to maintain, modify and debug
  •  Provides reusable application framework
  •  Rapid development

Do you have any questions? I would be glad to answer and help or make a dedicated post.

No comments:

Post a Comment

C# Interview Prep: 100 Common Questions for 0-3 Years Experience

Common C# Interview Questions  Basics of C# Language: What is C#? C# (pronounced C sharp) is a modern, object-oriented programming language...