[Solución] Constructor Semántico
Solución
class Empleado {
String nombre;
String tipo;
Empleado.tiempoCompleto(this.nombre) : tipo = 'Tiempo Completo';
Empleado.tiempoParcial(this.nombre) : tipo = 'Tiempo Parcial';
}
void main() {
Empleado john = Empleado.tiempoCompleto('John');
Empleado doe = Empleado.tiempoParcial('Doe');
print(john.nombre);
print(doe.nombre);
}Last updated