9.1 FUNCTION DECLARATIONS


9.1 FUNCTION DECLARATIONS

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.




Programming With Objects[c] A Comparative Presentation of Object-Oriented Programming With C++ and Java
Programming with Objects: A Comparative Presentation of Object Oriented Programming with C++ and Java
ISBN: 0471268526
EAN: 2147483647
Year: 2005
Pages: 273
Authors: Avinash Kak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net