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

> Except it is not extendable.

Function pointers are a good way to achieve extensibility in such cases.



You are basically doing a VMT implementation by hand.

I rather let the compiler do the work for me.


No, using function pointers does not necessarily mean implementing a vtable.


No, but it feels like it.

Oberon and Modula-3 only provide record extensions for OOP, with methods being done via function pointers.

In case you aren't familiar with these languages, here is some info.

http://www.inf.ethz.ch/personal/wirth/ProgInOberon.pdf (Chapter 23)

http://en.wikipedia.org/wiki/Modula-3#Object_Oriented

In Oberon's case, which was lucky to have survived longer at ETHZ than Modula-3 did at DEC/Olivetti, all successors (Oberon-2, Active Oberon, Component Pascal, Zonnon) ended up adding support for method declarations.




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

Search: