nameをsuzukiのままで色だけをCar.newのときに変えたいです。
1個目の書き方を教えて下さい!
###該当のソースコード
class Car
attr_reader :name, :color
def initialize(name = "suzuki",color = "red")
@name = name
@color = color
end
end
car = Car.new(,"blue")
puts car.name
puts car.color
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。