OOP Principles and SOLID Principles
The Four Pillars of Object-Oriented Programming
Abstraction
Abstraction refers to hiding unnecessary details from the user and only showing essential features.
Encapsulation
Encapsulation refers to putting related code into its own class and then restricting access to that class. In C#, access modifiers (public
or private
) can control whether a property of an object can be modified by other parts of the program.
Inheritance
Inheritance refers the passing of data and functionality from a parent class to a child class. This removes redundant code by allowing for subtypes that contain all the properties of the base class.
Polymorphism
Polymorphism refers to objects of different classes being accessible through the same interface.