|
Because C++ compilers do not possess look-ahead capability, it is necessary to declare a function prior to its invocation. A C++ function may be declared either via its implementation code, or by just declaring its prototype. C++ function prototypes look like this:
double cos( double ); double cos(double x); void f(int, int, int*); void g();
A function prototype may contain parameter names for better program readability, as in the second example. However, the compiler simply ignores such names.
Java does not require that methods be declared prior to their invocation.
|