Initialize Method
Lesson 30Author : GOUP
Last Updated : September, 2020
Code
class Book
attr_accessor :title, :author
def initialize(title, author)
@title = title
@author = author
end
end
book1 = Book.new("Harry Potter", "JK Rowling")
# book1.title = "Half-Blood Prince"
puts book1.title