Пример #1
0
        static void Main(string[] args)
        {
            //用多态来实现 将 移动硬盘或者U盘或者MP3插到电脑上进行读写数据

            //MobileDisk md = new MobileDisk();
            //UDisk u = new UDisk();
            //Mp3 mp3 = new Mp3();
            //Computer cpu = new Computer();
            //cpu.CpuRead(u);
            //cpu.CpuWrite(u);
            //Console.ReadKey();

            MobileStorage ms  = new UDisk();//new Mp3();//new MobileDisk();//new UDisk();
            Computer      cpu = new Computer();

            cpu.Ms = ms;
            cpu.CpuRead();
            cpu.CpuWrite();
            //Computer cpu = new Computer();
            //cpu.CpuRead(ms);
            //cpu.CpuWrite(ms);
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //用多态来实现 将 移动硬盘或者U盘或者MP3插到电脑上进行读写数据

            //MobileDisk md = new MobileDisk();
            //UDisk u = new UDisk();
            //Mp3 mp3 = new Mp3();
            //Computer cpu = new Computer();
            //cpu.CpuRead(u);
            //cpu.CpuWrite(u);
            //Console.ReadKey();

            MobileStorage ms = new UDisk();//new Mp3();//new MobileDisk();//new UDisk();
            Computer cpu = new Computer();
            cpu.Ms = ms;
            cpu.CpuRead();
            cpu.CpuWrite();
            //Computer cpu = new Computer();
            //cpu.CpuRead(ms);
            //cpu.CpuWrite(ms);
            Console.ReadKey();
        }