1
0
Fork 0

Beginn aufgabe Design Pattern

ChaosLL1337 2026-10-22 09:37:18 +00:00
parent 623b10273f
commit bf881b9671
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module gitty.informatik.th-mannheim.de/steger/pr3-ws202627/go/04-design-pattern
go 1.27.3

View File

View File

@ -0,0 +1,35 @@
package patterns
type Noodle struct {
Type string
Name string
Length int
Girth int
}
type NoodleMaker struct {
noodle Noodle
}
func newNoodleMaker() *NoodleMaker {
return &NoodleMaker{
noodle: Noodle{"Röhre", "Fusili", 10, 5},
}
}
func (b *NoodleMaker) Length(l int) *NoodleMaker {
b.noodle.Length = l
return b
}
func (c *NoodleMaker) Girth(g int) *NoodleMaker {
c.noodle.Girth = g
return c
}
func (d *NoodleMaker) Name(n string) *NoodleMaker {
d.noodle.Name = n
return d
}
func (e *NoodleMaker) Type(t string) *NoodleMaker {
e.noodle.Type = t
return e
}