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

Nonvirtual functions are effectively always final; if you have a pointer to a Foo which has a nonvirtual member function Bar, then you will always call Foo::Bar even if the thing being pointed to is actually an instance of a subclass that defines its own Bar member function.

Using final without a base class only makes sense if you don't actually want virtual semantics but specifically need the function to be in the vtable for some reason (such as for COM).



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

Search: