[Rk_2014_1020] cannot declare member function 'static int FOO: bar () 'To Have static Linkage

Source: Internet
Author: User

1.

If you declare a method to be static in your. CC file.

The reason is thatStaticMeans something different inside. CC files than in Class declarations it is really stupid, but the keywordStaticHas three different meanings. In the. CC file, the static keyword means that the function isn' t visible to any code outside of that particle file.

This means that you shouldn't useStaticIn. CC file to define one-per-class methods and variables. fortunately, you don't need it. in C ++, you are not allowed to have static variables or static methods with the same name (s) as instance variables or instance methods. therefore if you declare a variable or method as static in the class declaration, you don't needStaticKeyword in the definition. The Compiler still knows that the variable/method is part of the class and not the instance.

 

2. the URL of this article [TOM-and-Jerry was published at, May 20,]

Http://www.cnblogs.com/tom-and-jerry/p/4037965.html

[Rk_2014_1020] cannot declare member function 'static int FOO: bar () 'To Have static Linkage

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.