Files
papeer/book/book.go
2021-09-14 22:21:44 +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
}