December 2001
Intermediate to advanced
304 pages
6h 25m
English
Difficulty: 3
Forward declarations are a great way to eliminate needless compile-time dependencies. But here's an example of a forward-declaration snare. How would you avoid it?
Forward declarations are very useful tools. In this case, they don't work as the programmer expected. Why are the marked lines errors?
// file f.h // class ostream; // error class string; // error string f( const ostream& );
Without including any other files, write the correct forward declarations for ostream and string above.
1. Forward declarations are very useful tools. In this case, they don't work as the programmer expected. Why ...
Read now
Unlock full access