Thursday, March 2, 2017

Class and Object definition

Class:

Class is user defined datatype like built in data type .There will be variable and function.

Example:

   class Organigation
        {
            public string Student;
            private float Mark;
            public void Display();
        }

Object:

Object is called class type variable .Every class is called object.

Example:

    public class Stu
    {
        public Stu(String name)
      {
        Console.WriteLine(" Name is :" + name );
      }

     public static void main(String[] args)
    {
       // object create here 
            Stu myname = new Stu("tommy"); 
    }

    }

No comments:

Post a Comment