In the following code, when is the attribute bar is created in the object foo? - during new or duing setting of the attribute? Based on this, how is what attr_accessor does is different from how properties are declared in Java or similar languages?
class Foo
attr_accessor :bar
end
foo = Foo.new
foo.bar = 10
puts foo.bar
Homework Submissions
1 total
rohshall (Self-grade: Outstanding)
Submitted 1 year ago | Permalink
| Time spent: 1 minute
No comments. Sign up or log in to comment