Interface (computing): Difference between revisions

Content deleted Content added
Interfaces in practice: exception specifications as part of interface
Line 7:
 
== Uses of interfaces ==
The concept of interface is the cornerstone of [[modularmodularity (programming)|modular]] programming, a forerunner and a standard ingredient of [[object-oriented programming]]. In object-oriented programming, an object's interface consists of a set of methods that the object will typically respond to. Note that the object does not make its instance variables a part of its interface - these are typically accessed by means of [[accessor method]]s.
 
Some object-oriented programming languages mandate that the interface to the object be specified to the compiler separately from the implementation of that object, whilst others relax the requirement. For example, a class in a programming languages such as [[Objective-C]] consists of its interface, specified in a header file, and the implementation in the source file. Because of the [[dynamic typing|dynamically typed]] nature of Objective-C, one can send messages to any object, and the interface to the class becomes important as it specifies the methods the class responds to.