Product
Inherits Reference < Object
Classe (e não struct ou record) porque record em Crystal expande para uma struct
(tipo por valor). Usamos classe (tipo por referência) para que alterações de saldo
(product.quantity += n) modifiquem diretamente a instância guardada no array.
Constructors
new(code : Int32, name : String, price : Float64, quantity : Int32)
SourceInstance methods
code
Sourcecode=(code : Int32)
Sourcename
Sourcename=(name : String)
Sourceprice
Sourceprice=(price : Float64)
Sourcequantity
Sourcequantity=(quantity : Int32)
Source