C++中不存在接口,而java有接口,是因为java的运行机制是JVM,为了达到一个子类继承多个父类的特征,特别设置了接口,用来存储多个父类的特征供子类继承。

解决方案 »

  1.   

    其实接口是类行为的规范,是java实现多重继承的一种改良。
      

  2.   

    建议看看这个帖子
    http://expert.csdn.net/Expert/topic/1605/1605848.xml?temp=.5802423
    要理解深入,多看些例子
      

  3.   

    我晕, C++没有接口????我倒!!!!C都能实现, C++却退步了:(
      

  4.   

    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
    还用于面向对象中的多态
      

  5.   

    "为了达到一个子类继承多个父类的特征,特别设置了接口,用来存储多个父类的特征供子类继承。"
    ~~~~~~nod,希望楼主能明白..
      

  6.   

    sorry,分给的不够全理.有意见的请发消息给我,在以后的贴子中把分补给你.谢谢大家的参与.
      

  7.   

    虽然结了贴,今天才看到贴,我觉得有必要回一下贴解释一下,
    我说的前面一句话可能存在不妥的地方,我只知道C++是一种功能强大且灵活的语言,实现多继承是不需要接口的,原因我上面的帖子说过。
    一个系统分析员面对的是客户的需求,对客户的需求都把不准,可以转行了!
    如果有意见的话,给我发消息,互相学习吗。谢谢!!!
    如果觉得给分不公平,我和楼主一样给分
    QQ:41151181