learning_go/spec_course/Lec20/rectangle/rectangle.go
a.pivkin 0635aaa5ae kk
2025-07-16 08:15:26 +03:00

14 lines
214 B
Go

package rectangle
type Rect struct {
A,B int
color string
}
func New(newA int, newB int, newColor string) *Rect {
return &Rect{newA,newB,newColor}
}
func (r *Rect) Perimeter() int {
return 2 * (r.A + r.B)
}