Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Best modern language to learn object oriented programming. Parent comment
Dog *dog = new Dog() LoggingWrapper *wrapper = new LoggingWrapper(dog) wrapper->runAround()
In Smalltalk, you can implement `LoggingWrapper doesNotUnderstand:` to output the log entry; something like:
doesNotUnderstand: aMessage Logger log: target class, ' ', aMessage selector, ' called'. ^ aMessage sentTo: target.
There are no comments on this comment yet.
In Smalltalk, you can implement `LoggingWrapper doesNotUnderstand:` to output the log entry; something like:
It's not impossible to implement a class like LoggingWrapper using vtables -- in order to make a vtable, you have to know all a class's methods at compile time, but LoggingWrapper can respond to any method its target responds to.