Friday, 17 August 2012

Class with Example in .net

What is Class?
Class is a template for an object which is encapsulate the variables, methods and a type.
every object of this class will inherit the property(Type) of this class.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        int inter;
        public int method()
        {
            inter = 300;
            return inter;
        }

        static void Main(string[] args)
        {
            Program ob = new Program();
            Console.WriteLine("This Page count "+ob.method()+"  "+ "Hits");
            Console.ReadKey();
         
        }

    }
}

No comments:

Post a Comment