Lecture overview -- Keyboard shortcut: 'u'  Previous page: Properties - Basic Use -- Keyboard shortcut: 'p'  Next page: Properties in C# -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    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 ?
  }

}