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.