标签:
Static in C++
Two basic meanings
Static Storage
--allocated once at a fixed address
Visibility of a name
--internal linkage
Don‘t use static except inside functions and classes.
Uses of "static" in C++
Static free functions----deprecated弃用
Static globle variables----deprecated弃用
Static local variables----Persistent storage持久存储
Static member variables----Shared by all instances所有对象共享
Static member functions----Shared by all instances, can only access static member variables所有对象共享,只能访问静态变量或静态函数
Static inside functions
Value is remembered for entire program
Initialization occurs only once
面向对象程序设计-C++_课时28静态对象_课时29静态成员
标签:
原文地址:http://www.cnblogs.com/denggelin/p/5637939.html