C++ static 关键字:面试必须掌握的 5 个要点
摘要:
1. static 成员变量:声明与定义的分离 普通 static 成员变量在类内只是声明,必须在类外显式定义并初始化,否则链接错误。 struct A { static int s; // 声明 }; int A::s = 42; // 定义(必须) 例外:static const 整型(in/c 阅读全文
posted @ 2026-11-19 11:17 利昂萧侯 阅读(2) 评论(0) 推荐(0)
浙公网安备 33010602011771号