Skip to content

Instantly share code, notes, and snippets.

@vanderhoop
Created December 9, 2014 13:32
Show Gist options
  • Select an option

  • Save vanderhoop/190972996609a2fc8c4c to your computer and use it in GitHub Desktop.

Select an option

Save vanderhoop/190972996609a2fc8c4c to your computer and use it in GitHub Desktop.

Defining the Student class

You just learned how to write a Ruby class definition, the abstract "blueprint" you'll use to create objects of your own design. Now put that knowledge to use.

Exercise Objective(s)

  • get meaningful reps writing class definitions with getter and setter methods

Directions

  1. Create a file called student.rb
  2. Write a class definition for Student, using the in class example User as a guide.
  3. Define getter and setter methods (making sure that they work as you go) for the following attributes:
  • first_name
  • last_name
  • prior_occupation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment