What does “contract” of a class mean

后端 未结 8 1540
再見小時候
再見小時候 2020-12-05 04:18

I am reading the book The Java Programming Language. In the chapter which explains overriding method, it says:

Making an override met

8条回答
  •  庸人自扰
    2020-12-05 05:00

    The contract of a class or interface, in Java or any other OO language, generally refers to the publicly exposed methods (or functions) and properties (or fields or attributes) of that class interface along with any comments or documentation that apply to those public methods and properties.

    In the case of the relationship between a class and subclass, any protected methods or properties would be considered "publicly exposed," in the sense that they are exposed to the subclass.

提交回复
热议问题