Java – can I implement multiple callback interfaces in C?

Can I implement multiple callback interfaces in C for Java?

Solution

The answer is No You can only implement a callback interface in C, and there are some good reasons The callback mechanism depends on the fact that there is a Java type that implements the callback interface This Java type has all the knowledge to delegate callback calls to C objects maintained internally as pointers

If you implement multiple callback interfaces in C, you will aggregate multiple Java implementation types in C Each type only knows how to handle its own callback methods, but does not know how to handle callback methods of other aggregate types

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>