Question:Which of the following code fragments are correct syntax for implementing an indexer?
A class Sentence{ string[] words; public string this[int index]{ get{return words[index];} set{words[index]=value;} } }
B class Sentence{ string[] words; public string this[int index,int index2]{ get{return words[index];} set{words[index]=value;} } }
C class Sentence{ public string this[int index,int index2]{ get{return words[index];} set{words[index]=value;} } }
D class Sentence{ string[] words; public string Index[int index]{ get{return words[index];} set{words[index]=value;} } }
+ AnswerA B
+ Report