We provide IT Services

Register Now Click On

Read More Tutorials Click On

Post Page Advertisement [Top]


Object are just like reference pointer.

Object are the basic run-time entity in an object oriented programming language. 

c# in create the object with new operator.

Object is used to allocate the memory according to blueprint(Class).

Syntax:-

(Rock r = new Rock();)//Allocate the memory//


Example of Class and Object:-


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

namespace What_is_object_in_c_sharp
{
    class Program
    {
        int Empid;
        string Emp_Name;
        static void Main(string[] args)
        {
            Program P1 = new Program();
            P1.Empid = 100;
            P1.Emp_Name = "Rock Programmer";
            Console.WriteLine(P1.Empid);
            Console.WriteLine(P1.Emp_Name);
            Console.ReadKey();
        }
    }
}
output is:-



No comments:

Post a Comment

| Designed by Rockprogrammer