| A client of A which uses the indexer of A. | Lecture 5 - slide 13 : 29 Program 2 |
using System;
class B {
public static void Main(){
A a = new A(5);
double d;
a[1] = 6; a[2] = 7.0; a[3] = 8.0;
d = a[1] + a[2];
Console.WriteLine("a: {0}, d: {1}", a, d);
}
} | a refers to an instance of class A: anAObject. Setting d, e, and f via the indexer. Corresponds to d = a.d + a.e in case d and e had been public. |