Ch0000 / ruby-oo-fundamentals-object-attributes-lab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby Object Attributes Lab

Objectives

  1. Define ruby classes.
  2. Define methods that read from and write to instance variables.
  3. Create object properties using methods and instance variables.

Overview

This lab is all about using instance variables within a class to create methods that represent attributes or properties of an object.

Instructions

Get started with this lab by clicking the "Fork" button, cloning, and running learn test.

Dog and lib/dog.rb

Give a Dog a Name

You'll be teaching Dog about their names through two methods, #name, and #name= that read and write to a corresponding instance variable @name.

Give a Dog a Breed

Dog Breeds

You'll be teaching Dog about their breed through two methods, #breed, and #breed= that read and write to a corresponding instance variable @breed.

Person and lib/person.rb

Give a Person a Name

You'll be teaching Person about their names through two methods, #name, and #name= that read and write to a corresponding instance variable @name.

Give a Person a Job

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.

About


Languages

Language:Ruby 100.0%