Skip to content

Instantly share code, notes, and snippets.

@zeldani
Created February 27, 2014 18:59
Show Gist options
  • Save zeldani/9256722 to your computer and use it in GitHub Desktop.
Save zeldani/9256722 to your computer and use it in GitHub Desktop.
class vetor:
def __init__(self, a, b):
self.a = a
self.b = b
def __str__(self):
return 'Vetor (%d, %d)' % (self.a, self.b)
def __add__(self, outro):
return vetor(self.a + outro.a, self.b + outro.b)
v1 = vetor(3, 10)
v2 = vetor(8, -2)
print v1 + v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment