コード例 #1
0
        static void Main(string[] args)
        {
            var automoveis = new Automoveis();

            var fusca  = new Automovel("Fusca", 100);
            var bmw    = new Automovel("BMW", 300);
            var camaro = new Automovel("Camaro", 250);
            var hilux  = new Automovel("Camaro", 200);

            automoveis.ListaDeAutomoveis = new Automovel[] {
                fusca,
                bmw,
                camaro,
                hilux
            };

            var selection = new SelectionSort();

            selection.Ordenar(automoveis.ListaDeAutomoveis);

            foreach (var auto in automoveis.ListaDeAutomoveis)
            {
                Console.WriteLine(auto.Marca + " " + auto.VelocidadeMaxima);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jpprobr/DesignPatterns
        static void Main(string[] args)
        {
            // Cria a Fábrica da Honda com seus respectivos automóveis
            FabricaHonda honda = new FabricaHonda();
            Automoveis auto = new Automoveis(honda);

            // Cria a Fábrica da Suzuki com seus respectivos automóveis
            FabricaHonda suzuki = new FabricaHonda();
            auto = new Automoveis(suzuki);
        }