Based on what I have been reading about the Liskov Substitution Principle, I understand that a square and rectangle class cannot be a part of the same inheritance tree.
I would like to apply these ideas to a Folder and a File, as they commonly exist on disk. Is there a property of one or the other or both which would force a conclusion they too should not be part of the same inheritance tree according to Liskov?
What are some properties we could consider?
The data. Files consist of bytes. However, Folders can be considered to consist of the bytes of the files they contain.
Access to both is defined by permissions
I suppose the property where inheritance breaks down would be one concerning containment. A folder contains files. A file does not. However, if one considers that a file is just a collection of bytes, then a folder could be considered to be just the collection of bytes consisting of the files in the folder.
Is there a property of a file or a folder that requires us to maintain two inheritance trees?
draw(location)
, and if that's all you need in your abstract interface, then it's fine. In other words, it's not some universal property of rectangles and squares that results in a violation of Liskov SP, but what the base type is defined to be, and what its methods mean and how they are expected to be used.