I'm trying to create a constructor with a default value. The complication comes from the use of separate header and code files for the class. I've got a header file that contains:
class foo {
    bool dbg;
    public:
        foo(bool debug = false);
}
And a code file containing:
foo::foo(bool debug = false) {
    dbg = debug;
}
When I try and compile with g++ (i.e. g++ -c foo.cc), it gives an error:
foo.cc:373:65: error: default argument given for parameter 1 of ‘foo::foo(bool)’
foo.h:66:4: error: after previous specification in ‘foo::foo(bool)’
What am I doing wrong?
 
     
     
     
     
    