Multiple choice

What will be the output of the following code? using System;abstract class Base { protected int number; public abstract int this[int index]; class Child : Base { public override int this[int index] { get { return number; } set { number = value; } } } class Test { public static void Main() { Child obj = new Child(); obj[0] = 20; obj[1]=40 Console.WriteLine(The value is: + obj[0]); } } }

  1. 0

  2. 20

  3. 40

  4. Compilation error

  5. None of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

It will not compile because there are get and set attribute missed after the indexer's declaration. There should be public abstract int this[int index]{ get; set;} code like to remove this error.