OOP in C# Step by Step

Posted by

What is OOPS and what is the advantage of OOP?

OOP stands for “Object-Oriented Programming.” Remember, it’s OOP not OOPS,’S’ may stand for system, synopsis, structure, etc. It is a programming approach entirely based on objects, instead of just functions and procedures like in procedural languages. It is like a programming language model organized around objects rather than “actions” and data rather than logic. An “object” in an OOP language refers to a specific type, or “instance,” of a class. Each object has a structure exactly similar to other objects in a class but can have individual properties/values. An object can also invoke methods, specific to that object.

OOP makes it easier for developers to structure and organize software programs. Individual objects can be modified without affecting other aspects of the program therefore it is also easier to update and change programs written in object-oriented languages. Since the nature of software programs has grown larger over the years, OOP has made developing these large programs more manageable and readable.

What are OOP Concepts?

Following are OOP concepts explained in brief, we’ll take the topics in detail.

  1. Data Abstraction: Data Abstraction is a concept in which the internal and superfluous details of the implementation of logic are hidden from an end user(who is using the program) . A user can use any of the data and methods from the class without knowing about how this is created or what is the complexity behind it. In terms of a real-world example, when we drive a bike and change the gears we don’t have to care about how internally it’s working, like how the liver is pulled or how the chain is set.
  2. Inheritance: Inheritance is the most popular Concept in OOPs.This provides a developer an advantage called reusability of code. Suppose a class is written having functions with specific logic, then we can derive that class into our newly created class and we don’t have to write the logic again for derived class functions, we can use them as it is.
  3. Data Encapsulation: Wrapping up member data and member functions of a class in a single unit is called encapsulation. The visibility of the member functions and data members is set via access modifiers used in class.
  4. Polymorphism: Poly means many and morphism means many functions The Concepts Introduce the form of many behaviors of an object.
  5. Message Communication: Message Communication means when an object passes the call to the method of class for execution.

OK, we covered lots of theory, now it’s time for action. I hope that will be interesting. We’ll cover the topics in a series as follows,

Following is the detailed series with practical examples to learn OOP with C# end to end.

  1. Diving in OOP (Day 1): Polymorphism and Inheritance(Early Binding/Compile Time Polymorphism)
  2. Diving in OOP (Day 2): Polymorphism and Inheritance (Inheritance)
  3. Diving in OOP (Day 3): Polymorphism and Inheritance (Dynamic Binding/Run Time Polymorphism)
  4. Diving in OOP (Day 4): Polymorphism and Inheritance (All about Abstract classes in C#)
  5. Diving in OOP (Day 5): All about access modifiers in C# (Public/Private/Protected/Internal/Sealed/Constants/Readonly Fields)
  6. Diving in OOP (Day 6): Understanding Enum in C# (A Practical Approach)
  7. Diving into OOP (Day 7): Properties in C# (A Practical Approach)
  8. Diving into OOP (Day 8): Indexers in C# (A Practical Approach)
  9. Diving into OOP (Day 9): Understanding Events in C# (An Insight)
  10. Learning C# (Day 10): Delegates in C# (A Practical Approach)
  11. Learning C# (Day 11) – Events In C# (A Practical Approach)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.