9.2 Time Class case stud Preprocessor Wrapper 现象:头文件被重复引用 est. cpp预处理 include结果 ∥/ah //test. cpp class af int a, class Af #include"a.h" #include"bh class af int a 1 int a class b double b:1 } int maino ∥/b.h int maino #include a h Aa class Bo Bb. Aa double b: return 0: Bb } return UR error C2011:A:class' type redefinition 0 2018, SEU. All rights reserved. 7© 2009, SEU. All rights reserved. © 2018, SEU. All rights reserved. 7 9.2 Time Class Case Study --- Preprocessor Wrapper 现象:头文件被重复引用 // a.h class A{ int a; }; // b.h #include "a.h" class B{ double b; }; // test.cpp #include "a.h" #include "b.h" int main() { A a; B b; return 0; } class A{ int a;} class A{ int a;} class B{ double b;} int main() { A a; B b; return 0; } Test.cpp预处理include结果 error C2011: 'A' : 'class' type redefinition