Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define class
- $Jet = new-object psobject -Property @{
- guid = $null
- airline = $null
- flight = $null
- passengers = $null
- crew = $null
- fuel = $null
- cargo = $null
- model = $null
- }
- #constructor
- function Jet { #constructor
- param(
- [Parameter(Mandatory=$false)]
- [guid]$guid,
- [Parameter(Mandatory=$false)]
- [string]$airline,
- [Parameter(Mandatory=$false)]
- [int]$flight,
- [Parameter(Mandatory=$false)]
- [int]$passengers,
- [Parameter(Mandatory=$false)]
- [int]$crew,
- [Parameter(Mandatory=$false)]
- [int]$fuel,
- [Parameter(Mandatory=$false)]
- [int]$cargo,
- [Parameter(Mandatory=$false)]
- [string]$model
- )
- $Jet = $Jet.psobject.copy()
- $Jet.guid = [guid]::NewGuid() #$guid #[System.GUID]::NewGuid().ToString().ToUpper()
- $Jet.airline = $airline
- $Jet.flight = $flight
- $Jet.passengers = $passengers
- $Jet.crew = $crew
- $Jet.fuel = $fuel
- $Jet.cargo = $cargo
- $Jet.model = $model
- $Jet
- }
- #define class
- $Airspace = new-object psobject -Property @{
- active = $null
- jets = $null
- type = $null
- }
- #constructor
- function Airspace { #constructor
- param(
- [Parameter(Mandatory=$false)]
- [bool]$active,
- [Parameter(Mandatory=$false)]
- [int]$jets,
- [Parameter(Mandatory=$false)]
- [string]$type
- )
- $Airspace = $Airspace.psobject.copy()
- $Airspace.active = $active
- $Airspace.jets = $jets
- $Airspace.type = $type
- $Airspace
- }
- #start using classes
- $Airspace = Airspace -active 1 -jets 0 -type Civilian
- $Jet1 = Jet -airline American -flight 551 -passengers 200 -crew 20 -fuel 1000 -cargo 1 -model 777
- $Jet2 = Jet -airline Southwest -flight 1001 -passengers 100 -crew 10 -fuel 500 -cargo 1 -model 737
- $Jet3= Jet -airline United -flight 552 -passengers 300 -crew 20 -fuel 1000 -cargo 1 -model 747
- #$Airspace
- $Jet1
- $Jet2
- $Jet3
- $Airspace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement