add: interfaces assertion and composition (wip)

This commit is contained in:
Inanc Gumus
2019-08-20 19:03:57 +03:00
parent aa7fada2aa
commit 6b95995c81
14 changed files with 397 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
type puzzle struct {
title string
price float64
}
func (p puzzle) print() {
fmt.Printf("%-15s: $%.2f \n", p.title, p.price)
}
// TODO: NEW
func (p puzzle) sum() float64 {
return p.price
}