Created
          March 4, 2020 06:17 
        
      - 
      
- 
        Save harrisonmalone/8347da1e0be46d13bcb73eff316fb9c8 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Dog | |
| attr_reader :name, :age, :breed # etc | |
| def initialize(name, age, breed) | |
| @name = name | |
| @age = age | |
| @breed = breed | |
| end | |
| def name | |
| @name | |
| end | |
| def speak | |
| puts "woof" | |
| end | |
| end | |
| tilly = Dog.new("tilly", 4, "border collie") | |
| # => instance of a class | |
| tilly.speak | |
| # => instance method being called | |
| # getters | |
| p tilly.name | |
| # => tilly | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment