c++ 前置声明不能随便用 会引起类型不完全的错误

来源:岁月联盟 编辑:exp 时间:2012-07-18

as:

   XX.h
    namespace WebCore{

 class String

class A{
String test() const;

};
}


XX.cpp

namespace WebCore{

String A::test()const

{}

}
在XX.cpp的test函数就容易引起返回类型不完全错误

根本的原因就是String 不是在WebCore空间定义的,是在webkit中的WTF空间中

这一点还是要引起注意

 

作者:lihui130135