class Nbr(int):
    def __mul__(self, y):
        """Multiplication, retourne toujours 99"""
        return Nbr(int.__mul__(self, y))

    def __div__(self, y):
        """Division, retourne toujours -99"""
        return Nbr(-99)

    def __float__(self):
        """Conversion en flottant, retourne toujours la moitié du nombre"""
        return int.__float__(self) / 2

    def __gt__(self, y):
        """Opérateur de comparaison >, renvoie toujours faux"""
        return 0

class Complex:
    """Un nombre complexe"""

    def __init__(self, real, img):
        """Complex(réel, imaginaire)"""
        self.real = real
        self.img = img

    def __add__(self, c):
        """Addition"""
        return Complex(self.real + c.real, self.img + c.img)

    def __sub__(self, c):
        """Soustraction"""
        return Complex(self.real - c.real, self.img - c.img)

    def __mul__(self, c):
        """Multiplication"""
        return Complex(self.real * c.real - self.img  * c.img, \
                       self.img  * c.real + self.real * c.img)

    def __str__(self):
        """Représentation sous forme de chaîne de caractères"""
        return "(" + str(self.real) + ", " + str(self.img) + ")"

if __name__ == '__main__':
    #entiers
    a = Nbr(10)
    b = Nbr(15)
    print (a * b)
    print (a / b)
    print float(a)
    print float(b)
    print "a > b ? -->", a > b
    print "b > a ? -->", b > a

    print 20 * "="

    #complexes
    c1 = Complex(1, 2)
    c2 = Complex(3, 8)
    print c1
    print c2
    print (c1 + c2)
    print (c1 * c2)
