// ===++===
//
// OrtizOL
//
// ===--===
/*============================================================
//
// Clase: GetTypeEnJerarquia.cs
//
// Propósito: Mostrar el uso del método GetType en una
// jerarquía de herencia.
//
============================================================*/
using System;
public class ClaseBase
{
}
public class ClaseDerivada : ClaseBase
{
}
public class ClasePrueba
{
public static void Main()
{
ClaseBase cb = new ClaseBase();
ClaseDerivada cd = new ClaseDerivada();
object o = cd;
ClaseBase cb2 = cd;
// Prueba del método GetType
Console.WriteLine("El tipo de 'cb' es {0}", cb.GetType());
Console.WriteLine("El tipo de 'cd' es {0}", cd.GetType());
Console.WriteLine("El tipo de 'o' es {0}", o.GetType());
Console.WriteLine("El tipo de 'cb2' es {0}", cb2.GetType());
}
}
Ly8gPT09Kys9PT0KLy8KLy8JT3J0aXpPTAovLwovLyA9PT0tLT09PQovKj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQovLwovLyBDbGFzZTogR2V0VHlwZUVuSmVyYXJxdWlhLmNzCi8vCi8vIFByb3DDs3NpdG86IE1vc3RyYXIgZWwgdXNvIGRlbCBtw6l0b2RvIEdldFR5cGUgZW4gdW5hIAovLyBqZXJhcnF1w61hIGRlIGhlcmVuY2lhLgovLwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0qLwoKdXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIENsYXNlQmFzZQp7Cn0KCnB1YmxpYyBjbGFzcyBDbGFzZURlcml2YWRhIDogQ2xhc2VCYXNlCnsKfQoKcHVibGljIGNsYXNzIENsYXNlUHJ1ZWJhCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKCXsKCQlDbGFzZUJhc2UgY2IgPSBuZXcgQ2xhc2VCYXNlKCk7CgkJQ2xhc2VEZXJpdmFkYSBjZCA9IG5ldyBDbGFzZURlcml2YWRhKCk7CgkJb2JqZWN0IG8gPSBjZDsKCQlDbGFzZU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