Tuesday, 24 September 2013

Create a Class CUSTOMER with two private members ID and NAME, use this members in another class using PROPERTIES.

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

namespace customer
{
    class customer
    {
        private int cust_id = -1;
        public int ID
        {
            get
            {
                return cust_id;

            }
            set
            {
                cust_id = value;
            }
       
        }
        private string cust_name = string.Empty;
        public string name
        {
            get

            {
                return cust_name;
            }
            set
            {
                cust_name = value;
            }
       
        }


        static void Main(string[] args)
        {

            customer cust = new customer();
            cust.ID = 1;
            cust.name = "raman";

            Console.WriteLine("ID: {0}, Name: {1}", cust.ID, cust.name);

            Console.ReadLine();
        }
   
    }


}


No comments:

Post a Comment