Understanding the workflow of classes in c#

Understanding the workflow of classes in c#

Being a self-taught has been challenging and fun as well. So if you are like me who is self-taught or a trainee who is finding it difficult to maneuver your way on how object oriented programming works, welcome, in this article I will try to break it down as much as I can (don’t be like me who dumped this aspect of programming for a long time and ended up finding it tedious to navigate in the big ocean). Yep! Let’s dive into it.

Prerequisite: A beginner knowledge of C# programming language

It is sometimes difficult to familiarize oneself with working with classes and objects especially if you started up your programming journey with writing your programs in the entry point (i.e. Main method: static void main (string[] args)) and printing it out on the console. Before we discuss on the classes, lets know what OOP is;

Object-oriented programming (OOP) is a programming pattern, which uses objects and their interactions for building computer programs. Thus an easy to understand, simple model of the subject area is achieved, which gives an opportunity to the programmer to solve intuitively (by simple logic) many of the problems, which occur in the real world.

The class defines abstract characteristics of objects. It provides a structure for objects or a pattern which we use to describe the nature of something (some object). Classes are building blocks of OOP and are inseparably related to the objects.

We are going to introduce the concept object in the context of OOP. Software objects model real world objects or abstract concepts (which are also regarded as objects).

Segmenting your program/codes into classes will help you to easily manage and test-run your codes for bugs and help other developers to read and understand your programs. Let’s use the code snippet below to explain a bit of how it works.

Code.JPG

Result.JPG

Screenshot_20201113-234904.png

Basically, this is just a tip of the iceberg as working with OOP is a broad topic which encompasses so much like constructors, polymorphism, inheritance and the rest.

This is my first article on hashnode. Please, do well to let me know if this helped in some way in the comment section below. Thank you for reading till the end.