14 lines
281 B
Python
14 lines
281 B
Python
from dataclasses import dataclass
|
|
from decimal import Decimal
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Money:
|
|
amount: Decimal
|
|
|
|
def __add__(self, other):
|
|
return Money(self.amount + other.amount)
|
|
|
|
def __sub__(self, other):
|
|
return Money(self.amount - other.amount)
|