KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've found some strange code... //in file ClassA.h: class ClassA { public: void Enable( bool enable ); }; //in file ClassA.cpp #include <ClassA.h> void ClassA::Enable( bool enable = true ) { //implementation is irrelevant } //in Consumer.cpp #include <ClassA.h> .... ClassA classA; classA.Enable( true ); Obviously since Consumer.cpp only included ClassA.h and not ClassA.cpp the compiler will not be able to see that the parameter has a default value. When would the declared default value of ClassA::Enable in the signature of the method implementation have any effect? Would this only happen when the method is called from within files that include the ClassA.cpp ?
Tags (comma-separated)
Save Edits
Cancel