4 ms·
In some ways, they are sort of related. In chemistry, you have different representations (diamond/graphite) of the same underlying thing (carbon). In programm
by MereInterest 6y ago
In some ways, they are sort of related. In chemistry, you have different representations (diamond/graphite) of the same underlying thing (carbon). In programming, you have different representations (PointXY/PointRTheta) of the the same underlying concept (Point2D).
- jxramos 6y agoright, the roots of the word make it applicable to lots of stuff, poly or many, morph or structure/form.
- adrianmonk 6y agoArguably it's the strategy pattern. Graphite and Diamond are subclasses of CrystalizationStrategy.
- iainmerrick 6y agoThings could get messy real fast if you need to inherit from both Graphite and Diamond...
- chrisweekly 6y agoFavor composition over inheritance!
- frumiousirc 6y agoYes, the diamond inheritance pattern is a classic OO problem. :D
- LightMachine 6y agoThat isn't what polymorphism means, polymorphism would be more like Point<Float> and Point<Double> using the same Point definition.