What is forward declaration in c++? [duplicate]
Solution 1:
Chad has given a pretty good dictionary definition. Forward declarations are often used in C++ to deal with circular relationships. For example:
class B; // Forward declaration
class A
{
B* b;
};
class B
{
A* a;
};
Solution 2:
"In computer programming, a forward declaration is a declaration of an identifier (denoting an entity such as a type, a variable, or a function) for which the programmer has not yet given a complete definition."
-Wikipedia
Solution 3:
To the best of my knowledge, in C++ the term "forward declaration" is a misnomer. It's simply a declaration under a fancy name.