Windows/powershell/クラス
提供: 初心者エンジニアの簡易メモ
サンプル
HelloClass.ps1
class HelloClass {
[string] hello() {
return "Hello!!"
}
}
$helloObj = New-Object HelloClass
$helloObj.hello()
参考:https://www.vwnet.jp/Windows/PowerShell/2017082401/PSv5Class06.htm
サンプル静的クラス
HelloUtil.ps1
class HelloUtil {
static [int] hello([int] $test) {
return $test
}
}
[HelloUtil]::hello(11)
