Inheritance

Directories, files, and symbolic links, though certainly different, have something in common - they all have a name and possibly a set of permissions. To save a lot of code duplication bk has a simple inheritance tree: BkDir, BkFile, and BkSymLink all inherit from BkFileBase.

This is relevant for you when, for example, you look at the contents of a directory and want to figure out whether an item is a directory, so you could give it a special icon.

You can cast one type from another. It is always safe to cast down (to BkFileBase) but it is only sometimes safe to cast up (e.g. to BkDir). The next section explains how to detect the type of a BkFileBase and the section after that explains how to convert from one type to another.