Skip to content

Commit f733437

Browse files
committed
Polimorfismo
1 parent 63759bc commit f733437

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
File renamed without changes.

Desarrollo/14_Polimorfismo.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class Persona:
2+
3+
def __init__(self, nombre):
4+
self.nombre = nombre
5+
6+
def avanza(self):
7+
print('Ando caminando')
8+
9+
10+
class Ciclista(Persona):
11+
12+
def __init__(self, nombre):
13+
super().__init__(nombre)
14+
15+
def avanza(self):
16+
print('Ando moviendome en mi bicicleta')
17+
18+
19+
def main():
20+
persona = Persona('David')
21+
persona.avanza()
22+
23+
ciclista = Ciclista('Daniel')
24+
ciclista.avanza()
25+
26+
27+
if __name__ == '__main__':
28+
main()

0 commit comments

Comments
 (0)