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

You don't need any RTTI or code duplication for polymorphism, so long as you don't need general support for type-checked downcasts. If you do need type-checked downcasts, it can be as cheap as a single pointer on antirez's mylist->ops function table - a pointer pointing to the ancestor function table.

(Specific support for any single downcast is trivial - just write a function for the function table, typed appropriately and implemented appropriately.)



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

Search: