Design Patterns: The Four OO Basics
Before going into design patterns, one must need to know the four OO basics:
-
Abstraction is showing only the necessary details to the outside world. It is the abstract form of anything. It is implemented using interface and abstract class.
-
Encapsulation is hiding the details from the outside world. It is the opposite of abstraction. It is implemented using private and protected access modifiers inside a class.
-
Polymorphism, as it’s name suggests, means many shapes. In OOP it is providing a single interface to entities of different types. It is implemented in C# as abstract classes and virtual functions. See Polymorphism in C#.
-
Inheritance is a way for an entity to inherit the characteristics of another entity, thus establishing a parent-child relationship, or in a more technical OO term, an IS-A relationship. It is implemented using base and derived classes.