-->
当前位置:首页 > 题库

PROGRAMMING:Definition of USB interface

Luz5年前 (2021-05-10)题库491
Define a USB interface and implement it through mouse and USB flash disk classes. The specific requirements are as follows: < br / >
1. The interface name is USB, which includes two abstract methods: < br / >
void work(); Description can work < br / >
void stop(); Describe stop working < br / >
2. Complete the class mouse and implement the USB interface, and implement two methods: < br / >
The work method outputs "I click"< br/>
The stop method outputs "I can't click"< br/>
3. Complete the upan class and implement the USB interface, and implement two methods: < br / > 2
The work method outputs "I save"< br/>
The stop method outputs "I'm gone"< br/>
4. In test class main, in main method < br / >
Define interface variable usb1, store mouse object, then call work and stop method

Define the interface array USBs, which contains two elements. The 0 element stores an upan object, and the 1 element stores a mouse object. The loop array calls the work and stop methods for each element.
###Input format:
###Output format:
Outputs the result of the method call
###Input example:
Here is a set of inputs. For example:
```in
```
###Output example:
The corresponding output is given here. For example:
```out
I'll order a little
I can't order any more
I save
I'm leaving
I'll order a little
I can't order any more
```







answer:If there is no answer, please comment