From cf2285f91362b9b8e0195ea54d713d0b31c2ba13 Mon Sep 17 00:00:00 2001 From: ZZH <1462207500@qq.com> Date: Tue, 18 Jul 2023 05:58:10 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=8F=AF=E4=BB=A5=E6=AF=81?= =?UTF-8?q?=E6=8E=89=E4=BB=BB=E4=BD=95cpp=E4=BB=A3=E7=A0=81=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZZH <1462207500@qq.com> --- C++/stuipd_header.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 C++/stuipd_header.h diff --git a/C++/stuipd_header.h b/C++/stuipd_header.h new file mode 100644 index 0000000..51f7edb --- /dev/null +++ b/C++/stuipd_header.h @@ -0,0 +1,16 @@ +//在头文件里展开命名空间, 将导致源文件内出现莫名其妙的命名冲突 +using namespace std; +//在头文件里定义变量, 将导致源文件内出现重复定义 +int var1; + +class NewClassName +{ +private: + +protected: + +public: + NewClassName() {} + ~NewClassName() {} +//class定义最后缺少分号, 这个错误将导致报错定位在c文件里而非头文件里 +} -- Gitee