12 Sep 2017

what is class with Example

what is class

Class is a collection of data member and member function in an objected programming language. Data member is just like Data type and Member function 
just like a method of class. 

Some points of class:-

Class is a user define datatype,

Class is a Keyword,

Class is a Contener,

Class is a blue print,

Write A Simple Program a Class- Example

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

namespace Class
{
    class Animal
    {
        public string name = "Digveshwar";
        public int Age = 24;
        public void Print()
        {
       Console.WriteLine("Enter the Value of Nmae :" +name);
        Console.WriteLine("Enter the value of Age :" + Age);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Animal obj = new Animal();
            obj.Print();
            Console.ReadKey();  
        }
    }

}


No comments:
Write comments

Contact Form

Name

Email *

Message *

© 2014 Rock Programmer . Designed by Bloggertheme9
Powered by Rock Programmer.