What if the default parameter value is defined in code not visible at the call site?

前端 未结 4 1863
日久生厌
日久生厌 2021-01-12 04:52

I\'ve found some strange code...

//in file ClassA.h:
class ClassA {
public:
    void Enable( bool enable );
};

//in file ClassA.cpp
#include 

        
4条回答
  •  梦谈多话
    2021-01-12 05:08

    Would this only happen when the method is called from within files that include the ClassA.cpp?

    That's correct. But note that doing so will almost certainly produce multiple definition errors, so the default is only really available from its point of definition within ClassA.cpp.

提交回复
热议问题