This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Humano: | |
def __init__(self): | |
self.edad = 25 # aqui le doy un atributo a mi objeto | |
print 'soy un humano' | |
def hablar(self,mensaje): | |
print mensaje | |
pedro = Humano() | |
raul= Humano() | |
print 'Soy Pedro y tengo', pedro.edad | |
print 'Soy Raul y tengo', raul.edad | |
pedro.hablar('Hola') | |
raul.hablar('Hola Pedro') |
No hay comentarios:
Publicar un comentario