In most languages, the structure defined by the class determines the layout of the memory used by its instances.
[4] Some programming languages such as Eiffel support specification of invariants as part of the definition of the class, and enforce them through the type system.
In languages that support access specifiers, the interface of a class is considered to be the set of public members of the class, including both methods and attributes (via implicit getter and setter methods); any private members or internal data structures are not intended to be depended on by external code and thus are not part of the interface.
Object-oriented programming methodology dictates that the operations of any interface of a class are to be independent of each other.
[9] [citation needed] The buttons on the front of your television set are the interface between you and the electrical wiring on the other side of its plastic casing.
A television set also has a myriad of attributes, such as size and whether it supports color, which together comprise its structure.
A class represents the full description of a television, including its attributes (structure) and buttons (interface).
A common usage of access specifiers is to separate the internal data of a class from its interface: the internal structure is made private, while public accessor methods can be used to inspect or alter such private data.
For example, the Java language does not allow client code that accesses the private data of a class to compile.
parts would be typed to hold a collection of objects, such as instances of Body, Engine, Tires, etc.
This information can be utilized by developer tools to generate additional code besides the basic data definitions for the objects, such as error checking on get and set methods.
However, while some systems such as Flavors and CLOS provide a capability for more than one parent to do so at run time introduces complexity that many in the object-oriented community consider antithetical to the goals of using object classes in the first place.
If used carelessly this feature can introduce some of the same system complexity and ambiguity classes were designed to avoid.
[17] Most modern object-oriented languages such as Smalltalk and Java require single inheritance at run time.
The volatility of the Internet requires this level of flexibility and the technology standards such as the Web Ontology Language (OWL) are designed to support it.
Languages such as Flavors, CLOS, and Smalltalk all support this feature as part of their meta-object protocols.
Since classes are themselves first-class objects, it is possible to have them dynamically alter their structure by sending them the appropriate messages.
Other languages that focus more on strong typing such as Java and C++ do not allow the class hierarchy to be modified at run time.
Semantic web objects have the capability for run time changes to classes.
[22] If multiple inheritance is allowed, the hierarchy is a directed acyclic graph (or DAG for short), otherwise it is a tree.
Example (Simplified Objective-C 2.0 code, from iPhone SDK): In this example, a UITableView is a UIScrollView is a UIView is a UIResponder is an NSObject.
Depending on the semantic rules of the language, there may be additional restrictions on local classes compared to non-local ones.
[4][35] [36] The Common Lisp Object System (CLOS) provides metaobject protocols (MOPs) to implement those classes and metaclasses.
The primary motivation for the introduction of partial classes is to facilitate the implementation of code generators, such as visual designers.
With the arrival of the .NET framework 2, Microsoft introduced partial classes, supported in both C# 2.0 and Visual Basic 2005.
Object classes often facilitate rapid development because most object-oriented environments come with powerful debugging and testing tools.
Instances of classes can be inspected at run time to verify that the system is performing as expected.
[52] As a data type, a class is usually considered as a compile time construct.
[53] A language or library may also support prototype or factory metaobjects that represent runtime information about classes, or even represent metadata that provides access to reflective programming (reflection) facilities and ability to manipulate data structure formats at runtime.
Some dynamic languages do not make strict distinctions between runtime and compile time constructs, and therefore may not distinguish between metaobjects and classes.