Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Calculadora:
- def sumar(self, a, b):
- return a + b
- def restar(self, a, b):
- return a - b
- class CalculadoraCientifica:
- def __init__(self):
- self._calculadora = Calculadora()
- def potencia(self, a, b):
- return a ** b
- def __getattr__(self, atributo):
- return getattr(self._calculadora, atributo)
- calc = CalculadoraCientifica()
- print(calc.potencia(5, 2))
- print(calc.sumar(3, 2))
- print(calc.restar(3, 2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement