PowerShell Inheritance from Parent Class to Child Class


Example

class ParentClass
{
    [string] $Message = "Its under the Parent Class"

    [string] GetMessage()
    {
        return ("Message: {0}" -f $this.Message)
    }
}

# Bar extends Foo and inherits its members
class ChildClass : ParentClass
{

}
$Inherit = [ChildClass]::new()

SO, $Inherit.Message will give you the

"Its under the Parent Class"