tags:

views:

51

answers:

1

What's difference between these defining;

#include "QWebView"

class QWebView; 

+3  A: 

class QWebView; is a so called forward declaration. That means, you can't access details of the class (like methods/public variables) until the type is completely declared. The forward declaration, only tells the compiler that this particular type exists, whereas the full include tells the compiler, what methods etc. that class provides.

If you just wan't to use the type in a declaration, it's fine. But as soon, as you call a method on a variable of type QWebView, you will get an error, if you don't include the full declaration.

cypheon