rt

解决方案 »

  1.   

    哈哈 LZ写错了construct 构造,建造,想出
    constract 合同通常用constructor 说是 构造器,构造函数
      

  2.   

    如果楼主看的是英文原版教材,有的书上倒是有contract这种提法,指的就是类所implement的接口(interface)或者是老师发音不标准,把构造器constructor说成了contract?
      

  3.   

    contract吧,就是public修饰的东西(一般是方法吧),就是对外承诺的接口.
      

  4.   

    恩,我看的是英文版的Java书,里面的有些词汇用字典翻译不对的,只能问各位大侠了
      

  5.   

    construct 对类本身来说是做些 初始化 工作,
    对于 用它的类 是 在堆上创建对象
      

  6.   

    找到一个完整的contract解释,不过还是有点不明白
    Object-oriented programming strictly separates the notion of what is to be done from how it is done. "What" is described as a set of methods (and sometimes publicly available data) and their associated semantics. This combinationmethods, data, and semanticsis often described as a contract between the designer of the class and the programmer who uses it because it says what happens when certain methods are invoked on an object. This contract defines a type such that all objects that are instances of that type are known to honor that contract.A common assumption is that the methods declared in a class are its entire contract. The semantics of those operations are also part of the contract, even though they may be described only in documentation. Two methods may have the same name and parameters and throw the same exceptions, but they are not equivalent if they have different semantics. For example, not every method called print can be assumed to print a copy of the object. Someone might define a print method with the semantics "process interval" or "prioritize nonterminals"not that we'd recommend this. The contract of the method, both signature and semantics together, defines what it means.
      

  7.   

    都说不是construct,这个是构造方法我知道。
      

  8.   

    这里的 constract ,我认识应该是“约束”的意思。可能是描述 设计 和 使用之间的约定吧。我英文也不太好,猜测了。
      

  9.   

    这段话是The Java Programming Language里面的吧,最近也在看这本书,楼主哪句话不是很明白呢?
      

  10.   

    就是对contact不太明白。你看哪里了
      

  11.   

    contract
      双方或多方当事人(自然人或法人)关于建立、变更 、消灭民事法律关系的协议。此类合同是产生债的一种最为普遍和重要的根据,故又称债权合同。《中华人民共和国经济合同法》所规定的经济合同,属于债权合同的范围。合同有时也泛指发生一定权利、义务的协议。又称契约。如买卖合同、师徒合同、劳动合同以及工厂与车间订立的承包合同等。
    看了半天还是合同~~呵,不好意思···不过要流个东西的,嘿嘿····http://bbs.tsp2c.cn/?fromuid=136    希望兄弟们能体谅下小弟哦~~
      

  12.   

    试着翻译:
    面向对象的程序设计严格区分做什么和怎么做的概念。“做什么”被描述为一个方法集(有时还指公用数据)及其关联的语义。这种组合(方法,数据和语义)实际上是类的设计者和使用类的程序员之间的一种约定(contract),因为它说明了当调用对象上的某个方法时会发生什么。这个约定定义了一个类型,该类型的所有实例对象都被认为是遵从该约定的。
    通常假设类中声明的方法是它的全部约定。但操作的语义也是约定的一部分,即使它们仅在文档中介绍。两个方法可以具有相同的名字和参数,抛出相同的异常,但是如果语义不同,它们仍然是不一样的。例如,并不是所有称为print的方法都要打印出一份该对象,有人可能希望它的语义是处理间距或区分非终结符优先次序。方法的约定,包括签名和语义,决定了他的含义。