What changes must be done in the class to compile it
 
    public class Foo { 
         private int[] a = new int[10]; 
         private Dictionary<string, int> b;
         private int[] c = new int[100]; 

         public int this[int i] {         // 1 
             get { return a[i]; } 
             set { a[i] = value; }  
       } 

       public int this[string id] {   // 2 
            get { return b[id]; } 
            set { b[id] = value; } 
       } 

       public int this[int i, int j] { // 3
          get { return c[i*10 + j]; } 
          set { c[i*10 + j] = value; } 
      } 
  }
 
Explanation
Indexers can be overloaded by value parameters. It is allowed to have more than one value parameter.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes