Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # metodos privado
- class Base:
- def funcion(self):
- print("Metodo publico")
- def __funcion(self):
- print("Metodo privado")
- class Derivada(Base):
- def __init__(self):
- Base.__init__(self)
- def llamar_publico(self):
- self.funcion()
- def llamar_privado(self):
- self.__funcion()
- objeto1 = Base()
- objeto1.funcion()
- objeto2 = Derivada()
- objeto2.llamar_publico()
Advertisement
Add Comment
Please, Sign In to add comment