mirror of
https://github.com/NohamR/papeer.git
synced 2026-05-25 20:00:47 +00:00
first commit
This commit is contained in:
27
book/book.go
Normal file
27
book/book.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user