3 ms·
This is because by accepting data after construction with setSize, Rectangle is now invariant as a type. Immutable container types are covariant, because data o
by acjohnson55 9y ago
This is because by accepting data after construction with setSize, Rectangle is now invariant as a type. Immutable container types are covariant, because data only comes out. So you can apply LSP really only if you are willing to accept immutability.