mirror of
https://github.com/MADTeacher/go_basics.git
synced 2025-11-29 05:36:55 +02:00
отредактирована 3 глава
This commit is contained in:
32
part_3/3.6/golang/factory/shape/shape.go
Normal file
32
part_3/3.6/golang/factory/shape/shape.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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 (s *shape) GetName() string {
|
||||
return s.name
|
||||
}
|
||||
|
||||
func (s *shape) MoveCenter(point Point) {
|
||||
s.center = point
|
||||
}
|
||||
|
||||
func (s *shape) GetCenter() Point {
|
||||
return s.center
|
||||
}
|
||||
Reference in New Issue
Block a user