码迷,mamicode.com
首页 > 编程语言 > 详细

面向对象程序设计-C++_课时28静态对象_课时29静态成员

时间:2016-07-03 14:19:40      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

 

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!