C ++ specifications for your reference

Source: Internet
Author: User
 
01. /* file name: myclass. H 02. * Abstract: 03.*04. * Current Version: 05. * Author: 06. * Completion Date: 07.*08. * update Description: 09.*10. */11. 12. # ifndef myclass_h _ 13. # define myclass_h _ 14. 15. # include <string> // standard library header file 16. 17. # include "Other. H "// custom header file 18. 19. int g_initvalue;/the global variable starts with G. 20. Const int max = 100; // constants should all be capitalized. 21. 22. struct mystruct // global struct Declaration 23. {24. int num; 25. string name; 26. string address 27 .}; 28. 29. void addnumber (void); // The function name should use a verb or verb + noun. Uppercase letters are separated by uppercase letters. If no parameter is set, enter void. 30. 31. Class myclass // class declaration. The first letter of the class name is uppercase and separated by uppercase. 32. {33. public: 34. int addarea (INT width, int height); 35. 36. PRIVATE: // we recommend that you put the variable declaration behind it and take "action" as the center. You are concerned about interfaces. 37. Enum {size = 100, sizet = 200}; // The enumerated constant 38. Int m_width; 39. Int m_height; // The data member of the class starts with M. Avoid the Same Name of the data member and the member function parameter. 40. Static int s_initvalue; // The static variable starts with "S. 41. 42.}; 43. 44. # endif </span>

 
 
 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.