Chinaunix首页 | 论坛 | 博客
  • 博客访问: 583978
  • 博文数量: 141
  • 博客积分: 3425
  • 博客等级: 中校
  • 技术积分: 1609
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-23 15:55
文章分类

全部博文(141)

文章存档

2019年(5)

2011年(19)

2010年(36)

2009年(13)

2008年(50)

2007年(18)

分类: C/C++

2011-07-27 10:51:53

The Meaning of static

The keyword static has many different meanings in C++. The table show how static can be used.

The meanings of static

Usage


Meaning


Variable outside the body of any function


The scope of the variable is limited to the file in which it is 
declared.


Variable declaration inside a function


The variable is permanent. It is initialized once, and only one 
copy is created even if the function is called recursively.


Function declaration


The scope of the function is limited to the file in which it is 
declared.


Member variable


One copy of the variable is created per class (not one per 
object).


Member function


Function can only access static members of the class. 


阅读(577) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~