Exemplo n.º 1
0
        public classTest_Damien()
        {
            Market     market     = new Market();
            PowerPlant powerplant = new GasPowerPlant("Centrale", market);

            Console.WriteLine(powerplant.GetType());
            Console.WriteLine("----------------------------------");
            if (powerplant is GasPowerPlant)
            {
                Console.WriteLine("power plant est de type GasPowerPlant");
            }
            else
            {
                Console.WriteLine("power plant n'est pas de type GasPowerPlant");
            }
        }
Exemplo n.º 2
0
        public PowerPlant CreateNewGasPowerPlant(string name, Market market)
        {
            foreach (PowerPlant pp in PowerPlantList)
            {
                if (pp.GetName == name)
                {
                    Console.WriteLine("La centrale nommée {0} existe déjà. Entrez un nouveau nom :", name);
                    string newName = Console.ReadLine();
                    return(CreateNewGasPowerPlant(newName, market));
                }
            }
            PowerPlant NewPowerPlant = new GasPowerPlant(name, market);

            PowerPlantList.Add(NewPowerPlant);
            NodeList.Add(NewPowerPlant.GetOutputNode);
            LineList.Add(NewPowerPlant.GetOutPutLine);
            return(NewPowerPlant);
        }