Created
February 12, 2024 18:28
-
-
Save DDOrozco17/749984bbdd46698e81d1340f7e828436 to your computer and use it in GitHub Desktop.
herencia en dart
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{ | |
String? nombre; | |
int? edad; | |
double? estatura; | |
void verDatos(){ | |
print("Nombre : $nombre"); | |
print("Edad : $edad"); | |
print("Estatura : $estatura"); | |
}//fin function ver datos | |
}//fin clase humano | |
class Trabajador extends Humano{ | |
String? nEmpresa; | |
String? telefono; | |
int? cp; | |
String? email; | |
void datosEmpresa(){ | |
print("Nombre empresa : $nEmpresa"); | |
print("Telefono : $telefono"); | |
print("Codigo Postal : $cp"); | |
print("Email : $email"); | |
}//fin funcion | |
}//fin clase d etranajdor con herencia humano | |
void main() { | |
Trabajador supervisor = Trabajador(); | |
supervisor.nombre="Diego Diaz"; | |
supervisor.edad=18; | |
supervisor.estatura=1.80; | |
supervisor.nEmpresa="Papeleria"; | |
supervisor.telefono="6565310615"; | |
supervisor.cp=32583; | |
supervisor.email="diegodiaz@gmail.com"; | |
supervisor.verDatos(); | |
supervisor.datosEmpresa(); | |
} | |
Author
DDOrozco17
commented
Feb 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment