Stop learning alone!

Learn faster and stay on-track by joining this free class with other self-learners.

Register for Programming Ruby now.

Programming Ruby

Class length: 6 weeks. Start anytime.

Creator: rohshall

Status: Under Construction

Join this class!

Lesson 3: Assignment 1: Quiz

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