Hi All!!

My constructor's argument has a default value which is a 'static const' in a .h file. This argument sets a data member in the object to be constructed.

The argument of one of the member functions now has that data member as default argument.
But then it complains that that default member is not static. However, I do not want non-const static variables.

Here's an example of what I mean:
Code:
class FilterClass { .. };
static const FilterClass myFilter1(..);

class A {
 public:
 A(FilterClass const& p_filter = myFilter1)
   : filter(p_filter) { }
  void action(FilterClass const& p_filter = filter)
  {
    ...
  }
 protected:
  FilterClass filter;
};
I could not give the static const variables as default arguments in the constructor, but temporaries instead. However, for the member function "action" it becomes problematic:
the compiler raises an error telling that the argument's default is not static.

Making the protected data member static resolves the problem, however I do not want non-const static variables.
Just overloading the function without argument will do, but I am curious to how to resolve the problem.

Thanks a lot in advance!!

Mark