In myBase, the only constructor you have takes a single argument. In
mySubClass, the only constructor takes no arguments. For inheritance to
work, the sub classed constructor must somehow call the base class
constructor. if there's no argument to pass, it doesn't know how.
If you change mySubClass to:
class mySubClass : myBase
{
mySubClass(int x) {}
}
that will work.
Optionally, you can specify which base class constructor to call and do
something like:
class mySubClass : myBase
{
mySubClass() : base(4) {}
}
In this case, we're passing the constant integer 4 to the base class
constructor.
Pete
--
http://www.petedavis.net
"Randy" <rb***@sumaria.net> wrote in message
news:md*******************@nwrdny03.gnilink.net...
Problem reduced to simplist form:
abstract class myBase
{
myBase(int x)
{
Console.Writeline("x = {0}", x);
}
}
class mySubClass : myBase
{
mySubClass() {}
}
Yields the following error: "No overload for method 'myBase' takes '0'
arguments"
Any ideas on what I have to do to mySubClass to get this to compile?
Thanks,
Randy