Football Tutorial

    Get Free Football Tutorial details and much more.
  • Home
  • About
  • Champion of Champions
  • Football - Tournaments
  • CONTACT
  • PRIVACY

Sunday, 29 September 2019

Object-Oriented Programming in C#

 No comments   

Hi Guys, Welcome in my online tutorials.
In this online tutorial, I am going to explain you the basic understanding of Object-Oriented Programming in C#. 
Object-Oriented Programming also called OOPs. Note that it is a technique, not technology. It doesn’t provide any coding syntaxes for us. It provides us only the best techniques and suggestions to design and develop objects in programming languages.
In this tutorial, we are going to cover the following basic questions in detail to understand the Object-Oriented Programming.
  1. What is the need of Object-Oriented Programming in C#?
  2. Why real-world objects are required in a program?
  3. What Is the Object-Oriented Programming in C#?
  4. What are the OOPs principles in C#?
  5. What is the need of Encapsulation in C#?
  6. What is Abstraction in C#?
  7. What is Inheritance in C#?
  8. What is Polymorphism in C#?
  9. What are the different types of programming languages come under Object-Oriented Programming?

What is the need of Object-Oriented Programming in C#?
Oops (Object-Oriented Programming System) is a concept or technique to represent the real-world objects in a programming language. By using oops we are easily achieving our business requirements and provide better code security and code reusability. OOPs provide us some principles called pillars of oops.
Pillars of oops are:
1.   Abstraction
2.   Encapsulation
3.   Inheritance
4.   Polymorphism

Using these principles we can develop the real-world objects in a programming language easily.
Objects are basically the combination of all living and non-living things (such as Person, Animal, Books, Computer, Mobile etc.). So the real-world objects can be developed in object-oriented programming languages (like C#, Java, C++ etc.) by using the OOPs concept.

Why real-world objects are required in a program?
We know that the real-world objects are part of our day to day business. So we need real-world objects in our program to full fill the business requirements. For automating the business we are developing applications (software).
For example, to automate the School Management business we must create real-world objects like Student, Teacher, Principal, Accountant, Clerk, Office Assistant, Computer, Printer, Chair, table, etc. So along with School object, we must also have to create all the above objects because without all the above objects we cannot run School Management business.
So technically we call all the above objects are business objects.

What Is the Object-Oriented Programming in C#?
OOPs (Object Oriented Programming System) is a concept or methodology or technique. It provides a way of developing a program by creating class for both data and methods. Class can be used as a template for creating copies of different objects on demand.
We know that in procedural programming language programs are organized with action and logic.
In OOPs (Object Oriented Programming System), programs are organized with objects and data.

Points to Remember:
  1. OOPS principles suggest us how we should develop a program so that we can reuse it from one layer to another layers of the application effectively (Reusability).
  2. Reusability means we have to develop the Application in such a way that it should accept future changes without doing major changes in the application. Reusability is achieved by developing classes by integrating them in the loosely coupled way.
  3. We should develop the Software Application with Reusability in mind. As per the growth in business we must add required changes to the application with minimal changes or modifications in the existing application.
  4. As a developer, we always remember that as the business grows, customer increase new requirements day to day frequently and we must add these changes in our application. To add those new requirements we should not design the application from scratch. We must extend our existing application with minimum changes.
  5. So we must follow OOPs principles strictly from day one when we design the project at the initial stage for accepting future changes by client when required.

What are the OOPs principles in C#?
OOPs, provide us 4 main principles. They are:
  1. Encapsulation
  2. Inheritance
  3. Polymorphism
  4. Abstraction

What is Encapsulation?

Encapsulation is a process (or technique) of binding the data and functions together into a single unit, that single unit is called class. In simple word Encapsulation is a process/technique of creating a class by hiding its internal data members from outside the class. These internal data members are accessing using public methods and public properties in that class.

Remember: Data encapsulation is also called data hiding. Why?
Because by using Data encapsulation principle we can hide the internal data from outside the class.

What is Inheritance?
Inheritance is a process (or technique) by which the members of one class are transferred to another class. 
Parent/base class: it is a class from which the members are transferred to another class.
Derived/ child class: It is a class which inherits the members of the Parent class. We can achieve code reusability through inheritance.

Remember: Inheritance is used to achieve the code reusability.

What is Polymorphism?
Polymorphism is a process (or technique) by which we can achieve different behaviors from the same function/method.
Polymorphism perform different behaviors by taking different types of values or with a different number of values or different order of values.
There are two types of polymorphism
  1. Early binding/ Static polymorphism/compile-time polymorphism
  2. Late binding/ Dynamic polymorphism / Run time polymorphism
Early binding:  is achieved by using function overloading and operator overloading.
Late binding: is achieved by using function overriding.

What is Abstraction?
Data abstraction is a process (or technique) by which representing the essential features without including the background details. In simple words, Data abstraction is a process of defining a class with methods/functions with hiding its (methods) implementation details.

Methods are the best examples of abstraction. In methods we never know what they do internally, we know only is how to consume them (these methods).

What are the different types of programming languages come under Object-Oriented Programming?

C#, Java, C++, etc. are called object-oriented programming languages.


Here, in this article, I try to explain the basics of Object-Oriented Programming in C#. I hope you enjoy this article.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Home

0 comments:

Post a Comment

Sample Text

Copyright © Football Tutorial | Powered by Blogger
Design by | Blogger