Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
A class is composed of methods and variables. Variables can keep track of different states and values inside of a class. In this video, we'll modify our `Name` class to take a variable for the `title` attribute and see how that variable can be shared.
Code Samples
class Name
def initialize(title)
@title = title
end
def title
@title
end
def first_name
“Jason”
end
def middle_name
“”
end
def last_name
“Seifer”
end
end
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Michael Kristensen
Full Stack JavaScript Techdegree Graduate 26,251 PointsError when passing 4 parameters to the Name initialize method
1 Answer
-
Nick Evershed
6,429 Points1 Answer
-
nicolasverger3
3,451 Points2 Answers
-
MICHAEL P
5,191 PointsMy code is not passing, when I follow the video. Please help.
Posted by MICHAEL PMICHAEL P
5,191 Points2 Answers
-
Todd MacIntyre
12,248 Points1 Answer
-
Radek Noga
2,296 Points0 Answers
-
Sean Flanagan
33,236 Points2 Answers
-
Vishakha Agarwal
9,130 Points2 Answers
-
federico enrico
6,143 Points1 Answer
-
robrattray
4,666 Points1 Answer
-
Adam Zuckerberg
22,248 Points4 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up