![Learn Data Structures and Algorithms with Golang](https://wfqqreader-1252317822.image.myqcloud.com/cover/744/36698744/b_36698744.jpg)
上QQ阅读APP看书,第一时间看更新
drawContour method
The drawContour method of the DrawContour class calls the drawShape method on the shape instance, this is shown in the following code:
//DrawContour method drawContour given the coordinates
func (contour DrawContour) drawContour(x[5] float32,y[5] float32) {
fmt.Println("Drawing Contour")
contour.shape.drawShape(contour.x,contour.y)
}
//DrawContour method resizeByFactor given factor
func (contour DrawContour) resizeByFactor(factor int) {
contour.factor = factor
}
// main method
func main() {
var x = [5]float32{1,2,3,4,5}
var y = [5]float32{1,2,3,4,5}
var contour IContour = DrawContour{x,y,DrawShape{},2}
contour.drawContour(x,y)
contour.resizeByFactor(2)
}
Run the following commands:
go run bridge.go
The following screenshot displays the output:
![](https://epubservercos.yuewen.com/AA6936/19470380301498306/epubprivate/OEBPS/Images/c0562db0-8f61-409a-b8b9-a50c0d2ca323.png?sign=1738885809-jyRjY9wOcZCP1K9RilpL5EF99T0McGuI-0-cc8dfebb153a5d7aa5b7a259c2d454db)
We will take a look at Composite, Decorator, Facade and Flyweight design patterns in the next sections.