c++ - Evading including headers to the .h file -


I am told that I . To do CPP, they told me to create a prototype class:

  class abc; Instead of   

:

  include in "abc.h"   

but this is just a matter of ABC class Is not being used in the form of attribute or return value if it is a parameter, then I can use prototype ... why is it?

Besides, why is it so bad to include so many headers in .h file?

Thanks

If this is a parameter, then I Can I use ... why is this?

Whenever you do not need access to the internal structure of the declared class, you can use the next declaration, for example when you use an indicator, a reference, or a parameter As declared it passed. You can not use a forwarded declaration to call any member of the successor of a class or to reach its members, or to declare non-pointers / reference type members: This is because within the orbit The structure should go to the compiler

Why is it so bad to include so many headers in .h file?

This is not omnipresent "bad" in itself, but with many compilers it can slow down the compilation process, so it is specific to reducing your inclusion. Modern compilers have useful features (such as precompiled headers) to minimize the impact, so using further announcements, where you can have a more beauty choice than a practical case.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -