Inheritance from Parent Class to Child Class

suggest change
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”

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents