Data Access, Properties, and Methods - slide 6 : 29
Properties - Tricky Use
public class C {
private int v;
public C(int t){
v = t;
}
public int V {
get {return v * 2;}
set {v = value + 3;}
}
}
using System;
public class Client {
public static void Main(){
C x = new C(5);
x.V = 7; // activates setter: v is assigned to ?
Console.WriteLine(x.V); // activates getter: output ?
}
}