In read in this post that you could override a virtual function with other default arguments, but that it is not smart to do. My case is slightly different from the question there. The function in my base class and the function in my derived class should do exactly the same only the default argument is different. How should I go about achieving this?
EDIT with some sort of code example what I think might work but violates what is said in the earlier mentioned post and doesn't seem very neat to me:
class base {
public:
//not sure about the virtual here
virtual void func(bool something = true) { /*Do some stuff*/};
};
class derived : public base {
public:
void func(bool something = false) override
{
base::func(something); /*Doesn't seem like the way to go for me */
}
};
something = true
if you callfunc
from abase*
pointer.