简体   繁体   中英

Where should I put interface?

I program a class in which I have a method which takes an callback object from an external software. At the moment Eclipse says that it does not know the type of the object I gave as argument (it is expectable since I do not specify this type, it's done by the external software).

So, I think I need to write an interface for the object which I give as an argument to my method. In this respect I have two questions.

  1. Is it really so? Can I solve the mentioned problem in the mentioned way.

  2. If it is the case, where should I put this interface? In the same file where my class is? In the class? Outside of the class?

If the object is from "external software", then they should be providing you with some kind of API so that you can manipulate/inspect the callback object. So what you likely need to do is get the other software's API library and add it to the path for your eclipse project. Then eclipse should know eveyrthing it needs to about the object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM