Climbing the PowerShell Class Family Tree
When I started this series, I pointed out that a PowerShell class, while easy to define, lacks all the features of a traditional class defined in a language like C#. Fortunately, there is a class feature you can take advantage of, although I would venture to say it is for special use cases, which is inheritance.
PowerShell uses inheritance all the time. Often a class is defined from a parent class. And as in biology, the child class inherits values from the parent. In this case, these are items such as properties and methods. The child class is further defined by properties and methods unique to it.
You can see this hierarchy of classes by looking at an object’s type name.
PS C:\> $w = get-item c:\work
PS C:\> $w.psobject.typenames
System.IO.DirectoryInfo
System.IO.FileSystemInfo
System.MarshalByRefObject
System.Object
Want to read the full issue?