using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Personita { class Animal { public int Aire { get; set; } public void Respirar(int aire) { Console.WriteLine("Respirando {0}cm3 de aire", aire); this.Aire += aire; } } class Persona:Animal { //Atributo String Nombre; //Propiedad con {get; set;} ya hemos creado los getters y setters public string Nombre { get; set; } public double Altura { get; set; } public int Edad { get; set; } public bool Vivo { get; set; } //Constructor completo public Persona(string nombre, double altura, int edad, bool vivo) { this.Nombre = nombre; this.Altura = altura; this.Edad = edad; this.Vivo = vivo; } //Constructor vacio public Persona() { } public void Crecer(double cm) { //Aqui se le dice a la persona que crezca x centimetros Console.WriteLine("Creciendo {0} cm", cm); this.Altura += cm; } public void Envejecer(int anyos) { this.Edad += anyos; } } class Program { static void Main(string[] args) { //Persona p = new Persona("Osoitz", float.Parse("1,77") , 45, true); Persona p = new Persona(); p.Nombre = "Naiara"; p.Altura = 1.77; //p.Edad = 37; p.Vivo = true; p.Aire = 6; Console.WriteLine(p.Nombre); Console.WriteLine(p.Altura); Console.WriteLine(p.Edad); Console.WriteLine(p.Vivo); p.Crecer(0.03); Console.WriteLine(p.Altura); p.Envejecer(1); Console.WriteLine(p.Edad); p.Respirar(2); Console.WriteLine(p.Aire); Console.ReadLine(); } } }