first commit

This commit is contained in:
lapwat
2021-09-14 22:21:44 +02:00
commit 14856a109a
12 changed files with 1326 additions and 0 deletions

27
book/book.go Normal file
View File

@@ -0,0 +1,27 @@
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
}