C++ Default Argument Error
c++, default-arguments
Solution
You should only specify the default parameter in the function declaration, i.e. in the header. You implementation should look something like this:
void ComplexNumber::print(ostream & out) const { ..... }
Problem
Any Idea why this error is coming up at compile time? ``` ComplexNumber.cpp:21: error: default argument given for parameter 1 of ‘void ComplexNumber::print(std::ostream&) const’ ComplexNumber.h:17: error: after previous specification in ‘void ComplexNumber::print(std::ostream&) const’ ``` Here is my code at those certain areas: ComplexNumber.cpp ``` 21 void ComplexNumber::print(ostream & out = cout) const { ``` ComplexNumber.h ``` 17 void print(ostream & out = cout) const; ```