You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
526 B

package main
import "fmt"
// START OMIT
func main() {
p := &presentation{
slides: make([]slide, 0, 10),
author: "Ramon",
}
p.slides = append(p.slides, newIntroSlide(p.author))
fmt.Println(p)
}
type presentation struct {
slides []slide
author string
}
func (p *presentation) String() string {
return fmt.Sprintf("Author: %v, Number of Slides: %v",
p.author, len(p.slides))
}
func newIntroSlide(author string) slide {
return slide{text: "Author: " + author}
}
// END OMIT
type slide struct {
text string
}