作为一名C程序员,我想请教一个与C++相关的问题。
假设 doSomething() 有一个静态局部变量,是 C++ 中类的公共(public)方法。假设我们已经创建了这个类的两个实例。
现在,内存中是否只有这个静态变量的一个拷贝,在两个实例之间共享?我想应该是这样的。
最佳答案
Is there only one copy of this static variable in memory, shared between the two instances?
是
关于c++ - C++方法中的静态变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54878899/