This document summarizes the key topics in C# OOP that you should study and practice.
It follows the sequence of tutorials for better understanding.
- Introduction, Classes and Objects
- Constructors in Programming
- Events and Event Handlers
- Encapsulation Explained
- Inheritance Explained
- Polymorphism
- Partial Classes
- Interfaces
- Override Keyword & Overriding Methods
- Static Properties and Static Methods
- How to Study
- Recommended Practice
- What is Object-Oriented Programming (OOP)?
- Difference between Class (blueprint) and Object (instance).
- How to define a class in C#.
- Creating and using objects.
- Purpose of constructors.
- Types of constructors:
- Default constructor
- Parameterized constructor
- Copy constructor
- Constructor overloading.
- What are events in C#.
- Delegates and how they connect to events.
- Defining and subscribing to events.
- Event-driven programming examples.
- Concept of data hiding.
- Using private fields with public properties.
get
andset
accessors.- Benefits of encapsulation in real-world applications.
- What is inheritance and why it is used.
- Base (parent) and derived (child) classes.
: base
keyword in C#.- Benefits of code reuse.
- Concept of “many forms.”
- Compile-time polymorphism (method overloading).
- Run-time polymorphism (method overriding with
virtual
andoverride
). - Example: Shapes (Circle, Rectangle) implementing different behaviors.
- Splitting one class across multiple files.
- Benefits: teamwork and maintainability.
- Example usage in auto-generated code.
- What are interfaces and why we use them.
- Defining and implementing interfaces.
- Difference between abstract classes and interfaces.
- Real-world examples (e.g.,
IDisposable
,IEnumerable
).
- Difference between method overloading and overriding.
- Using
virtual
,override
, andsealed
. - Rules of method overriding in C#.
- What does
static
mean in C#. - Static fields and methods shared across all objects.
- When to use static vs instance members.
- Example: Utility classes like
Math
.
- Start with Classes and Objects as the foundation.
- Move to Constructors → Encapsulation → Inheritance.
- Learn Polymorphism for flexible code.
- Explore Events and Interfaces for real-world applications.
- Finish with advanced concepts like Partial Classes and Static Members.
- Build a simple Bank Account System:
- Encapsulation: Balance field with getter/setter.
- Constructors: Initialize account details.
- Inheritance: SavingsAccount, CheckingAccount.
- Polymorphism: Different
Withdraw
implementations. - Interface:
ITransaction
for Deposit/Withdraw. - Events: Trigger event when balance is low.