it's a C language concept than C++

guest (zack)
I think it will be narrower.
when a variable is defined outside any functioin, it is stored as static, no matter whether put "static" keyword before the variable.
If you put "static" before the variable, that means this variable can only be used within this .cpp file, cannot be used in any other .cpp file which even use "extern" keyword.

I guess the confusion is we usually use "static" within a function, in this case the "static" change the storage way of a variable from dynamic to static. this "static" is totally different concept as that "static" you mentioned.
2000-11-3 -05:00

回到话题: Jabber's Q(3)

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论