Why doesn’t polymorphism work without pointers/references?
“Surely so long as you allocate memory on the heap” – where the memory is allocated has nothing to do with it. It’s all about the semantics. Take, for instance: Derived d; Base* b = &d; d is on the stack (automatic memory), but polymorphism will still work on b. If you don’t have a … Read more