什么是事件和接口

An event is a set of outcomes that are defined in a class to trigger the event handlers in other classes. When an event is triggered, we can call any number of event handler methods. The link between a trigger and its handler method is actually decided dynamically at run-time

事件是在类中定义的一组结果,用于触发其它类中的处理程序. 当一个事件解发,我们可以调用任意事件的处理方法。触发器和其它程序之间处理方法世界是由动态运行时决定。

Interfaces are used when two similar classes have a method with the same name, but the functionalities are different from each other. Interfaces might appear similar to classes, but the functions defined in an interface are implemented in a class to extend the scope of that class.
两个相似的类具有相同的方法名称时,就使用接口,但功能不相同,接口可能出现在相似的类中,但在接口中定义的函数是在类中完成,扩大类的范围。

猜你喜欢

转载自blog.csdn.net/beyond911/article/details/115000484