Interface and Implementation

In some languages, this distinction between the external and internal views, between the interface and the implementation, is manifest on two distinct levels.

For example, many languages provide separators within a class, so that the interface is described in one area and marked as public, while the implementation is described in another area and marked as private.

In some languages, again C++ is a good example, the interface is itself described in one place (in C++, in an interface file), while the implementation is found somewhere else, in an implementation file.

Traditionally interface files have had a .h extension, while implementation files have a .cpp extension, but this is not a convention that is uniformly followed.

[audio] [real] Text to accompany slide9, in Chapter 3 of An Introduction to Object-Oriented Programming