Re:My favorite principle for code quality
by spc476 on Wednesday May 23, 2018 @01:13AM
(#17131602)
Once I learned about Unix, I felt that IO devices would make a better example of class inheritance. You have a base abstract class. From that, you get a block device (seekable devices with fixed-sized blocks), a character device (say, a serial port, or a keyboard), a variableblock device (like a tape drive or network, with variable sized blocks that may or may not be seekable). And then you can subclass from there. A more or less realistic example.
[ Parent
| on HN ]
There are no comments on this comment yet.