12.07.2015 Views

OO Example: Fractions

OO Example: Fractions

OO Example: Fractions

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Python customizations Now we can define the methods add, mul, etc.! Certain method names are special in Python: __init__: Called by the constructor when we setup anew instance __str__: Called by print __mul__: Overloads the (*) operator __add__: Overloads the (+) operator __le__: Overloads the (

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!