Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Herencias
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Perro tita = new Perro(); tita.edad = 1000; Perro pichi = new Pichinga(); ((Pichinga)pichi).miedo = 100; tita.MostrarEdad(); ((Pichinga)pichi).MostrarMiedo(); Perro prueba0 = new Astor(); // PASS Astor prueba1 = (Astor)tita; // FAIL Astor prueba2 = (Astor)pichi; // FAIL // <3 NACHO Y GISE <3 // y podes ver?????? // se supone que podes ver y editar al mismo tiempo..... System.Console.ReadKey(); } } public class Perro { public int edad; public void MostrarEdad() { System.Console.Write("\nEdad: {0}", edad); } } public class Pichinga : Perro { public int miedo; public void MostrarMiedo() { String strMiedo; if (miedo > 50) strMiedo = "cagada hasta las patas"; else strMiedo = "puede jugar sin asustarse"; System.Console.Write("\nPinchinga está {0}", strMiedo); } } public class Astor : Perro { public int altura; public void Saltar() { System.Console.Write("\nAstor saltó {0} metros", altura); } } }
run
|
edit
|
history
|
help
0
Fórum ➡ Building a List<> with questions and answers, from data in TXT file, using LINQ ♦
Encryption Practice
asxsdsdxasd
merge sort
1stoccurence
Palindrome using stack
Complex Variable Implementation in C#
Exception handling2
Strings: Padding Integers and Handling Decimal Float Numbers
async example with HttpClient