4 ms·
You’re right that classes exemplify declaring requirements upfront; the GP is limiting scope to what happens at compile time. Taking an argument of class Bar ty
by riwsky 4y ago
You’re right that classes exemplify declaring requirements upfront; the GP is limiting scope to what happens at compile time. Taking an argument of class Bar typically means taking pointers at runtime to a subclass’ method implementations.
Of course, optimizing compilers (especially JITs) can often devirtualize these anyway, so it’s not even that clear-cut.