开发者

What's difference between class QWebView; vs. #include <QWebView>

What's differenc开发者_高级运维e between these defining;

#include "QWebView"

class QWebView; 


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜