A function's interface consists of the function's name, its return type, the number and types of its arguments, and the types of exceptions it may throw. A Larch/C++ specification of a function can only be implemented by a C++ function, because the interface specified includes the C++ calling sequence, the way that function affects the C++ type checker, and so on. The concept of a behavioral interface specification language is discussed further in [Guttag-Horning-Wing85b] [Wing87] and [Lamport89]. (Also see section 1.1 Larch-style Specifications.)
In C++ a class has three interfaces (see Section 9.1c of [Ellis-Stroustrup90]).
date has as public members:
the constructor date, and the member functions day_of_month,
month, and
year, with the return types and parameters listed following
the C++ keyword public:.
The class date is a public subclass of printable,
and thus any public members of printable are also public members
of date.
class date : public printable, protected storable, private fast {
public:
date(int day, int month, int year);
int day_of_month();
int month();
int year();
protected:
void set_day(int day);
void set_month(int month);
void set_year(int year);
private:
int dy, mo, yr;
};
set_day,
set_month, set_year and any protected members inherited
from the superclasses printable and storable.
The fact that date is derived from storable, is
a protected subclass relationship, and thus part of the protected interface.
dy, mo, and yr.
The fact that date is derived from fast is
a private subclass relationship, and thus part of the private interface.
Go to the first, previous, next, last section, table of contents.