Creer des methodes Get et Set avec c#
Bonjours
J'ai voulu créer une classe article et j'ai utilisé des méthodes get et set pour chaque attribut ,mais le programme n'a pas voulu accepter les méthodes get et set
voici le code mais j'ai pas compris ou est l'erreur
Code:
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| public class clarticle
{//Attributs de la classe article
private string codeart;
private string codefamille;
private string designation;
private string codtva;
private string codetypearticle;
private double prixachatht;
private double marge;
private double prixventeht;
private string description;
//Accès aux attributs de la classe article
//Propriété code famille
//Méthode Get
public string Get()
{ Return codefamille; }
//Méthode Set
public void Set(string codef)
{ codefamille = codef; }
//Propriété code tva
//Méthode Get
public string Get()
{ Return codtva; }
//Méthode Set
public void Set(string codet)
{ codtva = codet; }
//Propriété code type article
//Méthode Get
public string Get()
{ Return codetypearticle; }
//Méthode Set
public void Set(string codety)
{ codetypearticle = codety; }
//Propriété code article
//Méthode Get
public string Get()
{ Return codeart; }
//Méthode Set
public void Set(string code)
{ codeart = code; }
//Propriété code article
//Méthode Get
public string Get()
{ Return designation; }
//Méthode Set
public void Set(string des)
{ designation = des; }
//Propriété prix achat hors taxe
//Méthode Get
public double Get()
{ Return prixachatht; }
//Méthode Set
public void Set(double prix)
{ prixachatht = prix; }
//Propriété marge
//Méthode Get
public double Get()
{ Return marge; }
//Méthode Set
public void Set(double mrg)
{ marge = mrg; }
//Propriété prix vente hors taxe
//Méthode Get
public double Get()
{ Return prixventeht; }
//Méthode Set
public void Set(double pri)
{ prixventeht = pri; }
//Propriété description
//Méthode Get
public string Get()
{ Return description; }
//Méthode Set
public void Set(string descrip)
{ description = descrip; } |