Class Introduction

C# Language is all about Object Oriented programming and classes. A class is a group of related methods and variables. Classes describes these things, and in most cases, you create an instance of this class, now referred to as an object, on this object, you use the defined methods and variables. The Windows Form itself is a Class, and when you run your programme, you are creating Objects , example: a Form object, a Textbox object etc. When define a class, define a design for a data type.

Class definition:

  //access specifier
    class Class_Name   
    {
        //Member variables
        //Data types
        double mVariable;

        //Member methods

        //access specifier
        void nMethod(parameter_list)
        {
            //body
        }
    }




  • To access the class members, you will use the dot “.” operator. All members of a class be declared as public( in which case they are directly accessible from outside the class) or as private ( in which case they are only visible to other code within the class) , just as in Visual Basic , C++ , and Java

No comments:

Post a Comment