Files
papeer/book/book.go
2021-09-24 02:09:22 +02:00

28 lines
405 B
Go

package book
type book struct {
name string
author string
chapters []chapter
}
func New(name, author string) book {
return book{name, author, []chapter{}}
}
func (b *book) AddChapter(c chapter) {
b.chapters = append(b.chapters, c)
}
func (b book) Name() string {
return b.name
}
func (b book) Author() string {
return b.name
}
func (b *book) Chapters() []chapter {
return b.chapters
}