Overview of Object Oriented Programming in C#

In this article we will learn overview of object oriented programming language . I have written this article  completely  focusing on beginners to make them understand about the OOPS concept.

Introduction

The programming in which data is logically represented in the form of a class and physically represented in the form an object is called as object oriented programming (OOP). OOP has the following important features.
    Class
      In OOP languages it is must to create a class for representing data. Class contains variables for storing data and functions to specify various operations that can be performed on data. Class will not occupy any memory space and hence it is only logical representation of data.
      Refer following article for depth explanation 
        Encapsulation
          Within a class variables are used for storing data and functions to specify various operations that can be performed on data. This process of wrapping up of data and functions that operate on data as a single unit is called as data encapsulation.
          Refer following article for depth explanation
            Abstraction
              Within a class if a member is declared as private, then that member can not be accessed from out side the class. I.e. that member is hidden from rest of the program. This process of hiding the details of a class from rest of the program is called as data abstraction. Advantage of data abstraction is security.

              Refer following article for depth explanation 
                Object and Instance
                  Class will not occupy any memory space. Hence to work with the data represented by the class you must create a variable for the class, which is called as an object. When an object is created by using the keyword new, then memory will be allocated for the class in heap memory area, which is called as an instance and its starting address will be stored in the object in stack memory area.
                  When an object is created without the keyword new, then memory will not be allocated in heap I.e. instance will not be created and object in the stack contains the value null. When an object contains null, then it is not possible to access the members of the class using that object.
                    Inheritance
                      Creating a new class from an existing class is called as inheritance. When a new class requires same members as an existing class, then instead of recreating those members the new class can be created from existing class, which is called as inheritance. Advantage of inheritance is reusability of the code. During inheritance, the class that is inherited is called as base class and the class that does the inheritance is called as derived class.
                      Refer following article for depth explanation  
                        Polymorphism
                          Polymorphism means having more than one form. Polymorphism can be achieved with the help of overloading and overriding concepts. Polymorphism is classified into compile time polymorphism and run time polymorphism.
                          Refer following article for depth explanation
                          Refer the following articles to learn more about OOPS concept.
                          Summary

                          I hope this article is useful for all readers,if you have any suggestion then contact me.





                          Post a Comment

                          www.CodeNirvana.in

                          Protected by Copyscape
                          Copyright © Compilemode