1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| public class Moniteur
{
private int id;
private string nom;
private string prenom;
// S'il existe d'autres colonnes dans ta table, rajoute les attributs. N'oublie pas de les renseigner en paramétre pour ton constrcuteur
/* Constructeur */
public Moniteur(int id, string nom, string prenom)
{
this.id = id;
this.nom = nom;
this.prenom = prenom;
}
/* Accesseur/Mutateur */
// Lorsque tu définis des propriétés, elles ont le nom de tes attributs mais avec une majuscule. Dans le cas contraire le compilateur te dira que ta propriété et ton attribut sont ambigues.
public int Id
{
get { return this.id;}
set {this.id = value; } // value prendra la valeur que tu affecteras à la propriété Id
}
public string Nom
{
get { return this.nom;}
set {this.nom = value; }
}
public string Prenom
{
get { return this.prenom;}
set {this.prenom = value; }
}
} |