18._4索引器概述及声明

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

namespace _18._4索引器概述及声明
{

    public class Clerk
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private char gender;
        public char Gender
        {
            get
            {
                if (gender != '' && gender != '') gender = '';
                return gender;
            }
            set
            {
                gender = value;
            }
        }

        private int[] myint = new int[10];
    //    public int this[int index]
    //    {
    //        get { return myint[index]; }
    //        set { myint[index] = value; }
    //}
     //public virtual int this[int index]
     //   {
     //       get { return myint[index]; }
     //   }

            public extern int this[int index]
        {
            get; set;
        }

        abstract class indexExample
        {
            abstract int this[int index]
            {
                get; set;
            }
        }
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

 

posted @ 2016-07-02 22:31  前缘Q+7589848  阅读(168)  评论(0编辑  收藏  举报