I'd say it's similar to why this code prints "Hello":
#include <cstdio>
class Hello {
public:
void print() { std::printf("Hello\n"); }
void action() { print(); }
};
class World: public Hello {
public:
void print() { std::printf("World\n"); }
};
int main() {
World w;
w.action();
return 0;
}
But if you declare print() as virtual it prints "World\n".Ok, I'll bite.
How do you treat a list of values of different types in a uniform way without using polymorphism/interfaces in Go?