using System;
public class ClaseBase
{
int numero;
// Constructor sin argumentos
public ClaseBase()
{
Console.WriteLine ("Invocación en ClaseBase()");
}
// Constructor de un argumento
public ClaseBase (int i)
{
numero = i;
Console.WriteLine ("Invocación en ClaseBase (int i)");
}
public int ObtenerValor()
{
return numero;
}
}
public class ClaseDerivada : ClaseBase
{
// Este constructor invoca el constructor de la clase base
public ClaseDerivada() : base()
{
}
// Este constructor llamará el construtor con un argumento
// de la clase base
public ClaseDerivada(int i) : base(i)
{
}
public static void Main ()
{
ClaseDerivada cd1 = new ClaseDerivada();
ClaseDerivada cd2 = new ClaseDerivada(1);
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIENsYXNlQmFzZQp7CiAgICBpbnQgbnVtZXJvOwogICAgCiAgICAvLyBDb25zdHJ1Y3RvciBzaW4gYXJndW1lbnRvcwogICAgcHVibGljIENsYXNlQmFzZSgpCiAgICB7CiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUgKCJJbnZvY2FjacOzbiBlbiBDbGFzZUJhc2UoKSIpOwogICAgfQogICAgCiAgICAvLyBDb25zdHJ1Y3RvciBkZSB1biBhcmd1bWVudG8KICAgIHB1YmxpYyBDbGFzZUJhc2UgKGludCBpKQogICAgewogICAgICAgIG51bWVybyA9IGk7CiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUgKCJJbnZvY2FjacOzbiBlbiBDbGFzZUJhc2UgKGludCBpKSIpOwogICAgfQogICAgCiAgICBwdWJsaWMgaW50IE9idGVuZXJWYWxvcigpCiAgICB7CiAgICAgICAgcmV0dXJuIG51bWVybzsKICAgIH0KfQogCnB1YmxpYyBjbGFzcyBDbGFzZURlcml2YWRhIDogQ2xhc2VCYXNlCnsKICAgIC8vIEVzdGUgY29uc3RydWN0b3IgaW52b2NhIGVsIGNvbnN0cnVjdG9yIGRlIGxhIGNsYXNlIGJhc2UKICAgIHB1YmxpYyBDbGFzZURlcml2YWRhKCkgOiBiYXNlKCkKICAgIHsKICAgIC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