Accessing Private Member From Class With the Help of Get Set



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

namespace getset
{
    public class information
    {
        private string name="Susana";
        public string NAME
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            information stu = new information();
            Console.WriteLine("the Member is : {0}",stu.NAME);
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment