package _11_综合练习;

public class Test {
    public static void useDevice(Device device){
        System.out.println("设备品牌"+ device.getBrand() +"设备价格"+device.price);
        device.work();
        if(device instanceof Phone){
            Phone phone = (Phone) device;
            phone.takePhoto();
        }else if(device instanceof Printer){
            Printer printer = (Printer) device;
            printer.scan();
        }
    }

    public static void main(String[] args) {
        Phone phone = new Phone();
        phone.setStorege("10G");
        useDevice(phone);

        Printer printer = new Printer();
        printer.setType("激光");
        useDevice(printer);
    }
}
