- Define ruby classes.
- Define methods that read from and write to instance variables.
- Create object properties using methods and instance variables.
This lab is all about using instance variables within a class to create methods that represent attributes or properties of an object.
Get started with this lab by opening it with learn open
and running learn
.
You'll be teaching Dog
about their names through two methods, #name
, and #name=
that read and write to a corresponding instance variable @name
.
You'll be teaching Dog
about their breed through two methods, #breed
, and #breed=
that read and write to a corresponding instance variable @breed
.
You'll be teaching Person
about their names through two methods, #name
, and #name=
that read and write to a corresponding instance variable @name
.
You'll be teaching Person
about their jobs through two methods, #job
, and #job=
that read and write to a corresponding instance variable @job
.
When you're done submit the lab with learn submit
View Object Attributes Lab on Learn.co and start learning to code for free.