计算机 选择题 标准 ★ 精品

this指针与静态成员 — 计算机选择题

C++ 程序设计(大学通用) 类与对象 AI 三重审校通过

题目
阅读代码,a.value() 在内层作用域结束后返回什么? class Item { int n; static int alive; public: Item(int x) : n(x) { ++alive; } ~Item() { --alive; } int value() const { return this->n + alive; } }; int Item::alive = 0; int main() { Item a(6); { Item b(9); } // 此处调用 a.value() } A. 6 B. 7 C. 8 D. 9