It goes something like this:
If you define a class without a constructor, then the compiler will
generate an implicit constructor that takes no arguments.
So, if you write:
class A
{
};
The compiler will generate:
class A
{
public A()
{
// does nothing.
}
}
However, if you define a class with a constructor, then the compiler
will NOT generate a default constructor for you.
So if you type:
class B
{
public B( double d )
{
// more code goes here.
}
}
The compiler will generate exactly that.
Suppose now that you want to inherit from B:
class C : B
{
public C()
{
// yet more code goes here.
}
}
Then the constructor for class C MUST call a constructor for class B.
Since you have not explicitly specified what constructir to call for
class B, the compiler will attempt to call a parametless constructor.
So, the compiler will TRY to generate:
class C : B
{
public C()
{
B();
}
}
But since you have already defined a constructor for class B, one that
DOES take a parameter, the compiler will not generate a default
parameterless constructor for B, and as such, the compilation will
fail.
To remedy this, either explicitly define a paramaterless constructor
for B, as follows:
class B
{
public B( double d )
{
// more code goes here.
}
public B()
{
// whatever.
}
}
Or, modify class C to explicitly call the constructor in class class B,
as follows:
class C : B
{
public C() : base(0.0)
{
// yet more code goes here.
}
}