【发布时间】:2020-07-17 04:34:17
【问题描述】:
静态成员函数中的局部静态变量在内存中的什么位置? 例如:
class Foo
{
public:
static void Bar()
{
static int fooBar;
}
};
“fooBar”在内存中的位置以及分配时间。
【问题讨论】:
-
像所有变量一样,它驻留在内存中编译器选择放置的任何位置。
标签: c++ static-methods static-variables