// ===++===
//
// OrtizOL
//
// ===--===
/*============================================================
//
// Clase: NuevaImplementacionToString.cs
//
// Propósito: Demostración sobreescritura de
// ToString en una clase derivada.
//
============================================================*/
using System;
public class ClaseDerivada
{
private object valor;
public ClaseDerivada(object valor)
{
this.valor = valor;
}
// Aquí sobreescribimos el método ToString con una
// nueva implementación.
public override string ToString()
{
return base.ToString() + ": " + valor.ToString();
}
}
public class PruebaClaseDerivada
{
public static void Main()
{
ClaseDerivada cd = new ClaseDerivada('j');
Console.WriteLine(cd.ToString());
}
}
Ly8gPT09Kys9PT0KLy8KLy8gICAgT3J0aXpPTAovLwovLyA9PT0tLT09PQovKj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQovLwovLyBDbGFzZTogTnVldmFJbXBsZW1lbnRhY2lvblRvU3RyaW5nLmNzCi8vCi8vIFByb3DDs3NpdG86IERlbW9zdHJhY2nDs24gc29icmVlc2NyaXR1cmEgZGUgCi8vIFRvU3RyaW5nIGVuIHVuYSBjbGFzZSBkZXJpdmFkYS4KLy8KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ki8KCnVzaW5nIFN5c3RlbTsKCnB1YmxpYyBjbGFzcyBDbGFzZURlcml2YWRhCnsKICAgcHJpdmF0ZSBvYmplY3QgdmFsb3I7CgogICBwdWJsaWMgQ2xhc2VEZXJpdmFkYShvYmplY3QgdmFsb3IpCiAgIHsKICAgICAgdGhpcy52YWxvciA9IHZhbG9yOwogICB9CgogICAgLy8gQXF1w60gc29icmVlc2NyaWJpbW9zIGVsIG3DqXRvZG8gVG9TdHJpbmcgY29uIHVuYSAKICAgIC8vIG51ZXZhIGltcGxlbWVudGFjacOzbi4KICAgcHVibGljIG92ZXJyaWRlIHN0cmluZyBUb1N0cmluZygpCiAgIHsKICAgICAgcmV0dXJuIGJhc2UuVG9TdHJpbmcoKSArICI6ICIgKyB2YWxvci5Ub1N0cmluZygpOwogICB9Cn0KCnB1YmxpYyBjbGFzcyBQcnVlYmFDbGFzZURlcml2YWRhCnsKICAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQogICB7CiAgICAgIENsYXNlRGVyaXZhZGEgY2QgPSBuZXcgQ2xhc2VEZXJpdmFkYSgnaicpOwogICAgICBDb25zb2xlLldyaXRlTGluZShjZC5Ub1N0cmluZygpKTsKICAgfQp9