-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathherenciaII.py
More file actions
26 lines (21 loc) · 883 Bytes
/
herenciaII.py
File metadata and controls
26 lines (21 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Persona():
def __init__(self,nombre,edad,lugarResidencia):
self.nombre = nombre
self.edad = edad
self.lugarResidencia = lugarResidencia
def descripcion(self):
print(f"Nombre: {self.nombre} , Edad: {self.edad} , Residencia: {self.lugarResidencia}")
class Empleado(Persona):
def __init__(self,salario,antiguedad,nombreEmpleado,edadEmpleado,residenciaEmpleado):
super().__init__(nombreEmpleado,edadEmpleado,residenciaEmpleado)
self.salario = salario
self.antiguedad = antiguedad
def descripcion(self):
super().descripcion()
print(f"Salario: {self.salario}, Antiguedad: {self.antiguedad}")
Gisela = Persona("Gisela",25,"Puebla")
Gisela.descripcion()
print(isinstance(Gisela, Empleado))
Posmo = Empleado(1500,15,"Posmo",6,"Casita")
Posmo.descripcion()
print(isinstance(Posmo, Persona))