Hacker News new | ask | show | jobs
by nebula 6136 days ago
Any definition of polymorphism should at least mention something about the method that is invoked depends on runtime data, and is not resolved (or known) at compile time.

At least in C++ world, it's not true. There things like compile time polymorphism, and run-time polymorphism.

And by the way, why do you think polymorphism should be based on run-time data? simpler things can be achieved at compile time with static analysis, which many OO languages do [C++, and Java for sure].

Just because it's simple to do, you don't have to declassify it from being polymorphic.

1 comments

Whenever I think of polymorphism in C++, I think of base pointers, virtual functions and the vtable. I guess my mind just puts run time and compile time in separate boxes.