Page 486 - IT2
P. 486

private static uint auto;

                                     public Catégorie(string NomCatégorie)
                                     {
                                         this.NomCatégorie = NomCatégorie;
                                         auto++;
                                         IdCatégorie = auto;
                                     }

                                     public Catégorie(string NomCatégorie, Catégorie catégorie)
                                     {
                                         this.NomCatégorie = NomCatégorie;
                                         this.catégorie = catégorie;
                                         auto++;
                                         IdCatégorie = auto;
                                     }

                                     public uint pIdCatégorie
                                     {
                                         get { return IdCatégorie; }
                                     }

                                     public string pNomCatégorie
                                     {
                                         get { return NomCatégorie; }
                                         set { NomCatégorie = value; }
                                     }

                                     public Catégorie pcatégorie
                                     {
                                         get { return catégorie; }
                                         set { catégorie = value; }
                                     }

                                     public new string ToString()
                                     {
                                         if(catégorie != null)
                                         return catégorie.ToString() + NomCatégorie + " / ";
                                         else return NomCatégorie + " / ";
                                     }
                                 }
                             }

                            Classe "Produit"


                             using System;

                             namespace Société_informatique
                             {
                                 public class Produit
                                 {
                                     private uint IdProduit;
                                     private string NomProduit;
                                     private float PrixProduit;
                                     private Catégorie catégorie;

                                     private static uint auto;

                             public Produit(string NomProduit, float PrixProduit, Catégorie catégorie)
                                     {
                                         this.NomProduit = NomProduit;
                                         this.PrixProduit = PrixProduit;
                                         this.catégorie = catégorie;
                                         auto++;
                                         IdProduit = auto;
                                     }


                     Filière                    Epreuve                        Session              9/13
                      TDI                 Synthèse V1(Correction)            Juillet 2014
   481   482   483   484   485   486   487   488   489   490   491