a
Or.txt
s
In this case to access to properties of class you should cast it inside
a
Yes I would not do it this way. I would specify the order. This is for Liskov as someone pointed out. Anyone should be able to make
class MyGridLayoutManager: GridLayoutManager
and your code should still work as though it's a
GridLayoutManager
. If you look at specific classes, your code is not allowing substitution.
It's common for two
when
cases to overlap. a
when
block is like a chain of
if else
, when you think about it like that, specifying order makes sense, it's not strange.
s
Thanks for your answers 🙂