Functions
C++ permits the definition of function that are not member of any class.
// define a function for the maximum
// of two integer values
int max (int i, int j)
{
if (i < j) return j;
return i;
}
int x = ...;
int y = ...;
int z = max(x, y);
Previous slide
Next slide
Back to first slide
View graphic version