问:智能指针可以对指针的引用数量进行计数,一个智能指针释放时,别的智能指针怎么知道的?
这是一个脑筋急转弯题。。。。
不像普通的变量,静态成员变量是被所有类对象共享的,不同的对象可以访问对方的该静态成员变量,因此静态成员变量和类对象并没有联系。
The static keyword has another meaning when applied to global variables -- it gives them internal linkage (which restricts them from being seen/used outside of the file they are defined in). Because global variables are typically avoided, the static keyword is not often used in this capacity.
Unlike normal member variables, static member variables are shared by all objects of the class.Static members are not associated with class objects
原文地址:https://www.cnblogs.com/dylanchu/p/11616369.html
时间: 2024-10-10 03:36:32