OOPS
General
Abstract Class
Sealed Class
Abstract and Sealed Classes and Class Members - C# Programming Guide - C# | Microsoft Learn
What is the Significance of Private Constructor?
A private constructor is a special instance constructor. If a class has one or more private
constructors and no public constructors, other classes cannot create instances of this class
If you do not use an access modifier with the constructor, it will still be private by default.
Private Constructors - C# Programming Guide - C# | Microsoft Learn
What is the significance of Protected Constructor?
What are the differences between Private Constructor and Static Constructor?
Why do we need properties?
Every class has a constructor though we do not create it. Constructor is a method with the name as the
class name and has no return type
What is virtual method?
Virtual method is used to implement late binding. It would allow the subclasses of the type to override the
method
Note:
1. Constructors cannot be virtual, while destructors can be virtual
2. Class’ default constructor is invoked when the class is created
3. Constructors are called in order from base class whereas destructors are called from in order
from derived classes
When do we need constructors and when do we need properties?
Constructors are used to initialize some of the fields which are mandatory while inserting the record into a
table e.g. Employee Id
Properties are used to set values that changes in an object based on some logic e.g. salary
Object Oriented Principle
1. Inheritence
2. Polymorphism
3. Abstraction
4. Encapsulation
Reference:
C# Design Patterns - step by step - made easy for Beginners. - YouTube
Late Binding
Early Binding
DuckTyping