close

 

 

使用時機
image
 
image
 

 This will reduce compile times etc. If that doesn't compile go for the #include. You have to go for the #include if you need to do any of the following:

  1. Access a member or function of the class.
  2. Use pointer arithmetic.
  3. Use sizeof.
  4. Any RTTI information.
  5. new/delete, copy etc.
  6. Use it by value.
  7. Inherit from it.
  8. Have it as a member.
  9. Instance in a function.

前置宣告

What are Forward declarations in C++ - GeeksforGeeks

 
 
 

 

 

REF:
https://stackoverflow.com/questions/2832714/header-files-inclusion-forward-declaration

arrow
arrow
    全站熱搜

    天才R 發表在 痞客邦 留言(0) 人氣()