3 ms·
Ah, I meant rectangle instead of parallelogram. Rectangle, rhombus, square. What's the inheritance hierarchy?
by ogogmad 4y ago
Ah, I meant rectangle instead of parallelogram. Rectangle, rhombus, square. What's the inheritance hierarchy?
- hot_gril 4y agoYeah, that's an example of inheritance not working. Python does support multi-inheritance, but it's messy. Best you can do is interfaces instead of subclasses. Honestly can't remember the last time I've subclassed something and actually cared to inherit methods/variables.
- rileyphone 4y agoThat's because there are two separate types of inheritance that often get conflated in popular OOP languages: subclassing (implementation inheritance) and subtyping (specification inheritance). The 'types' here are the interfaces in typical OOP languages, though their (especially Java) failure to orient types around them create much of the pain developers experience. See https://www.cs.utexas.edu/~wcook/papers/InheritanceSubtyping90/CookPOPL90.pdf https://www.cs.utexas.edu/~wcook/papers/InheritanceSubtyping...
- imtringued 4y agoNo language on earth does data dependent typing.
- hot_gril 4y agoRight, but some can infer your types with much less manual input than in Java or C++. Rust does more automatically. Or actually C++ is the most automatic if you really abuse templates, but the compiler error messages become impossible to read.