This file contains hidden or 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
| // Clase Padre (Superclase) | |
| class Juguete { | |
| String nombre; | |
| String material; | |
| double precio; | |
| Juguete(this.nombre, this.material, this.precio); | |
| void mostrarDatos() { | |
| print('--- Datos del Juguete ---'); |
This file contains hidden or 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
| void main() { | |
| print("* Mostrando datos desde función *"); | |
| misDatos(); | |
| // --- Llamadas a Funciones Tradicionales --- | |
| print(' '); | |
| print('--- Funciones Tradicionales ---'); | |
| int resSuma = sumar(10, 5); | |
| int resResta = restar(20, 8); | |
This file contains hidden or 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
| // Función con 3 parámetros nombrados requeridos y 1 opcional | |
| void misDatos({ required String nombre, required int edad,required String gpo, | |
| String milenguajedeprogramacion = "Dart", // Parámetro opcional con valor por defecto | |
| }) {//instrucciones dentro de la funcion | |
| print("Mi nombre es : $nombre"); | |
| print("Mi edad es : $edad"); | |
| print("Mi grupo es : $gpo"); | |
| print("Estoy programando en : $milenguajedeprogramacion"); | |
| }//fin funcion mis datos |
This file contains hidden or 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
| void misDatos() { | |
| String nombre ="Ivette Ruiz"; | |
| int edad=17; | |
| String gpo= "6I"; | |
| String milenguajedeprogramacion="Dart"; | |
| print("Mi nombre es : $nombre"); | |
| print("Mi edad es : $edad"); | |
| print("Mi grupo es : $gpo"); | |
| print("Estoy programando en : $milenguajedeprogramacion"); | |
| }//fin funcion misDatos( |
This file contains hidden or 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
| void main() { | |
| int edad=17; | |
| double estatura= 1.71; | |
| String nombre="Ivette Ruiz"; | |
| bool asistio= false; | |
| String gpo= '6I'; | |
| print("Desarrollador Ivette Ruiz"); | |
| print("* - - * - - * - - * - - *"); | |
| print("Mostrar datos"); | |
| print("Nombre : $nombre"); |