Im a bit confused. What is the difference between forward declaration and forward reference? Forward declaration is, in my head, when you declare a function that isnt yet implemented, but is this incorrect? Do you have to look at the specified situation for either declaring a case "forward reference" or "forward declaration"?
+3
A:
forward declarations are used to allow single-pass compilation of a language (C, Pascal).
if forward references are allowed without forward declaration (Java, C#), a two-pass compiler is required.
Maurice Perry
2009-03-30 09:37:08
+1
A:
From Wiki:
http://en.wikipedia.org/wiki/Forward_declaration
Forward Declaration:
Declaration of a variable or function which are not defined yet. Their defnition can be seen later on.
Forward Reference:
Similar to Forward Declaration but where the variable or function appears first the definition is also in place.
Prabhu. S
2009-03-30 09:40:53
Oh. So declaration is when you declare something, use it and then implement it. Reference is when you use, and then declare it?
mslot
2009-03-30 09:53:27
Yes. In terms of function references, the definition should have been done before use.
Prabhu. S
2009-03-30 10:01:55