Re:Where are we in the Python 3 transition?
by millstone on Friday January 01, 2016 @05:59PM
(#10823917)
C++ its own insane behavior, where default arguments are determined at the call site instead of at runtime. This means your function can get another function's default arguments.
#include <iostream>
struct Base {
virtual void foo(const char *name = "base") {
std::cout << "Base impl with " << name << " param\n";
}
};
struct Derived : public Base {
virtual void foo(const char *name = "derived") override {
std::cout << "Derived impl with " << name << " param\n";
};
};
int main(void) {
Base *b = new Derived();
b->foo();
}
Fortunately Python avoided that bit of silliness.