從父類到子類的繼承
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 會給你
它屬於父類