1
0
mirror of https://github.com/MADTeacher/go_basics.git synced 2025-11-23 21:34:47 +02:00
Files
go_basics/part_3/3.4/golang/factory/shape/shape.go
2025-06-04 18:38:52 +03:00

37 lines
508 B
Go

package shape
type Point struct {
X int
Y int
}
type Shape struct {
Name string
Center Point
color string
}
func (s *Shape) SetColor(color string) {
s.color = color
}
func (s *Shape) GetColor() string {
return s.color
}
func NewShape(name, color string, x, y int) Shape {
return Shape{
Name: name,
color: color,
Center: Point{X: x, Y: y},
}
}
func NewShapeWithPoint(name, color string, center Point) *Shape {
return &Shape{
Name: name,
color: color,
Center: center,
}
}