Accès aisé aux propriétés
Proposition 1 :
En utilisation le point comme séparateur
Proposition 2 :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 public class Person { public property String forename; public property int age; } Person p = new Person(); p.forename = "Stephen"; // calls setter String str = p.forename; // calls getter
En utilisant => comme séparateur
Proposition 3 :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 public class Person { public property String forename; public property int age; } Person p = new Person(); p=>forename = "Stephen"; // calls setter String str = p=>forename; // calls getter
En utilisant # comme séparateur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 public class Person { public property String forename; public property int age; } Person p = new Person(); p#forename = "Stephen"; // calls setter String str = p#forename; // calls getter
Partager