c++——inline

  • inline-- line of code is embedded, similar but more powerful macro (macro do not type checking)
  • Space for time
  • Not defination, but declaration
  • Recommend two or three lines of the short-function, or can be called many times (function cycle) is defined as inline
  • Large function (> 20 lines), a recursive function
  • Function bodies, do not need .h file .cpp file
  • Class member function write directly in the body of the function in the .h, no need to add inline keyword (.cpp do not need to complete the class definition)
  • It recommended that the get () and set () is defined as within the Union

Guess you like

Origin www.cnblogs.com/cxc1357/p/11829094.html