1class Employ
2{
3 public String name; //name of the employ
4
5 public String getName() //Get the name
6 {
7 return name;
8 }
9
10 public String setName(String newName) //Set the name
11 {
12 this.name = newName;
13 }
14}
15
1class Thing {
2 private int secret; // This is a field.
3
4 public int Secret { // This is a property.
5 get {
6 Debug.Print("Somebody is accessing the secret!");
7 return secret;
8 }
9
10 set {
11 Debug.Print("Somebody is writing to the secret!");
12 secret = value; // Note the use of the implicit variable "value" here.
13 }
14 }
15}
16