[ja] apply patch]
This commit is contained in:
@@ -156,7 +156,7 @@ methodはstructの上でしか使用されないのでしょうか?当然違
|
|||||||
b.color = c
|
b.color = c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bl BoxList) BiggestsColor() Color {
|
func (bl BoxList) BiggestColor() Color {
|
||||||
v := 0.00
|
v := 0.00
|
||||||
k := Color(WHITE)
|
k := Color(WHITE)
|
||||||
for _, b := range bl {
|
for _, b := range bl {
|
||||||
@@ -192,13 +192,13 @@ methodはstructの上でしか使用されないのでしょうか?当然違
|
|||||||
fmt.Printf("We have %d boxes in our set\n", len(boxes))
|
fmt.Printf("We have %d boxes in our set\n", len(boxes))
|
||||||
fmt.Println("The volume of the first one is", boxes[0].Volume(), "cm³")
|
fmt.Println("The volume of the first one is", boxes[0].Volume(), "cm³")
|
||||||
fmt.Println("The color of the last one is",boxes[len(boxes)-1].color.String())
|
fmt.Println("The color of the last one is",boxes[len(boxes)-1].color.String())
|
||||||
fmt.Println("The biggest one is", boxes.BiggestsColor().String())
|
fmt.Println("The biggest one is", boxes.BiggestColor().String())
|
||||||
|
|
||||||
fmt.Println("Let's paint them all black")
|
fmt.Println("Let's paint them all black")
|
||||||
boxes.PaintItBlack()
|
boxes.PaintItBlack()
|
||||||
fmt.Println("The color of the second one is", boxes[1].color.String())
|
fmt.Println("The color of the second one is", boxes[1].color.String())
|
||||||
|
|
||||||
fmt.Println("Obviously, now, the biggest one is", boxes.BiggestsColor().String())
|
fmt.Println("Obviously, now, the biggest one is", boxes.BiggestColor().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
上のコードはconstでいくつかの定数を定義しています。その後カスタム定義型を定義しています。
|
上のコードはconstでいくつかの定数を定義しています。その後カスタム定義型を定義しています。
|
||||||
@@ -211,8 +211,8 @@ methodはstructの上でしか使用されないのでしょうか?当然違
|
|||||||
|
|
||||||
- Volume()はレシーバをBoxとして定義します。Boxの堆積を返します。
|
- Volume()はレシーバをBoxとして定義します。Boxの堆積を返します。
|
||||||
- SetColor(c Color)はBoxの色をcに変更します。
|
- SetColor(c Color)はBoxの色をcに変更します。
|
||||||
- BiggestsColor()はBoxListに定義されており、listの中の体積が最大の色を返します。
|
- BiggestColor()はBoxListに定義されており、listの中の体積が最大の色を返します。
|
||||||
- PointItBlack()はBoxListのすべてのBoxの色を全部黒に変更します。
|
- PaintItBlack()はBoxListのすべてのBoxの色を全部黒に変更します。
|
||||||
- String()はColorに定義されており、Colorno具体的な色を返します(文字列形式)
|
- String()はColorに定義されており、Colorno具体的な色を返します(文字列形式)
|
||||||
|
|
||||||
上のコードは文字で書くと非常に簡単に思えませんか?私達は問題を解決する場合問題の描写を通して、対応するコードを書くことで実現します。
|
上のコードは文字で書くと非常に簡単に思えませんか?私達は問題を解決する場合問題の描写を通して、対応するコードを書くことで実現します。
|
||||||
|
|||||||
Reference in New Issue
Block a user