示例#1
0
 private Computer(Builder builder)
 {
     this.monitor   = builder.monitor;
     this.processor = builder.processor;
     this.ram       = builder.ram;
     this.vga       = builder.vga;
 }
示例#2
0
        static void Main(string[] args)
        {
            Monitor lgMonitor = new Monitor("1200x600", true, 32);
            Printer hpPrinter = new Printer("HP", "MP102", 50);

            VGA       nvdiaVGA       = new VGA("Nvdia", 2045, 2054);
            RAM       samsungRAM     = new RAM("DDR4", 5000, 8000);
            Processor intelProcessor = new Processor();

            intelProcessor.setcache(254);
            intelProcessor.setcore(8);
            intelProcessor.setseries("CORE i7 8th Gen");

            Computer computer = new
                                Computer.Builder(samsungRAM, nvdiaVGA, intelProcessor)
                                .withMonitor(lgMonitor)
                                .withPrinter(hpPrinter)
                                .build();

            Console.WriteLine(computer.ToString());
        }
示例#3
0
 public Builder(Ram ram, VGA vga, Processor processor)
 {
     this.ram       = ram;
     this.vga       = vga;
     this.processor = processor;
 }