When inheriting a base class you effectivly will cause the CLR to create an
instance of that base class.
Since your base class only have one constructor, and that constructor needs
a parameter. The CLR cannot create the base object.
To make this work, you need to supply the parameter to the base class from
the sub class.
Btw, what does Prueba mean ;)
<code>
class Prueba : Action
{
public Prueba() : base(null)
{}
public override void go()
{
Console.Write("Prueba says: ");
base.go();
}
}
</code>
--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"
"Fernando Rodríguez" <fe*******************@fernando-rodriguez.com> wrote in
message news:73********************************@4ax.com...
Hi,
If I try to compile the code below, I get a weird error that seems to be
related with hte constructors.
-------------------------------------
class Action : System.Object
{
Object _something;
public Action( Object something )
{
_something = something;
}
public virtual void go()
{
Console.WriteLine(_something.ToString());
}
}
class Prueba : Action
{
public override void go()
{
Console.Write("Prueba says: ");
base.go();
}
}
--------------------------------------------
The error says something like: no overload for the method Action requires
0
arguments.
What the Hell does this mean? O:-)
Thanks