Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe it's just me, and maybe I'm wrong or over-thinking it, but this question bugs me. I think this is a trick question, because there is no single right answer unless the question is prefaced with "in [language X], define polymorphism." I've lost track of the number of times I've been interviewed and had that awful question tossed at me.

Without fail, every single interviewer in my experience was looking for an answer strictly in terms of whatever language(s) they're using at the company, or whatever language the interviewer is most familiar with. If you stray outside of what they know and what they're looking for, they have no idea what you're talking about.

Polymorphism in Java is slightly different than for Ruby than for C than for Haskell than for yadda, yadda. No matter what, it's always going to be somewhat arbitrary and tied to some kind of language dependent implementation or feature. If your language doesn't even have classes, the answer is different, if your language doesn't have functions, it's different, etc, etc.

I suppose the closest thing to a right answer would be to define it in pure mathematical terms using Turing machine notation, so as to make it universal. However I have no idea if such an answer even exists. If anyone has seen such a thing, please do share it.

A better version I would ask would be: define polymorphism using x86 AT&T assembly. or: define what polymorphism represents



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: