Object Oriented Programming

Ruby / Open classes

class Object

  private 
   
   # your script code here
  class Dog
     attr_accessor :size

attr_accessor is a method that runs code that follows a template to create new methods.

$the_name = "size"

class Dog
  puts "Name is #{$the_name}"
  attr_accessor $the_name.to_sym
end

dog = Dog.new
p dog
dog.size = 19
p dog
Cat = Class.new
Cat.attr_accessor :size

my_cat =  Cat.new
my_cat.size = 12
p my_cat