The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but these are implicitly static and final. An interface provides only a form, but no implementation. Feedback An interface says, “This is what all classes that implement this particular interface will look like.” Thus, any code that uses a particular interface knows what methods might be called for that interface, and that’s all. So the interface is used to establish a “protocol” between classes. (Some object-oriented programming languages have a keyword called protocol to do the same thing.) Feedback用于实施规范,制定统一标准,比如jdbc 还用于面向对象中的多态
http://expert.csdn.net/Expert/topic/1605/1605848.xml?temp=.5802423
要理解深入,多看些例子
An interface says, “This is what all classes that implement this particular interface will look like.” Thus, any code that uses a particular interface knows what methods might be called for that interface, and that’s all. So the interface is used to establish a “protocol” between classes. (Some object-oriented programming languages have a keyword called protocol to do the same thing.) Feedback用于实施规范,制定统一标准,比如jdbc
还用于面向对象中的多态
~~~~~~nod,希望楼主能明白..
我说的前面一句话可能存在不妥的地方,我只知道C++是一种功能强大且灵活的语言,实现多继承是不需要接口的,原因我上面的帖子说过。
一个系统分析员面对的是客户的需求,对客户的需求都把不准,可以转行了!
如果有意见的话,给我发消息,互相学习吗。谢谢!!!
如果觉得给分不公平,我和楼主一样给分
QQ:41151181