#!/usr/bin/ruby

class Vector
  attr_accessor :x
  attr_accessor :y
  def initialize
    @x = 0
    @y = 0
  end
  def +(other)
    @x += other.x
    @y += other.y
  end
  def <<(other)
    @x = other.x
    @y = other.y
  end
  def [](index)
    if index == 1
      return @x
    elsif index == 2
      return @y
    else
      return 'no deal'
    end
  end
  def echo
    puts @x
    puts @y
  end
end

v1 = Vector.new
v2 = Vector.new

v1.x = 5; v1.y = 9;

v2 << v1
v2.echo

puts v2[1]
puts v2[3]

