compilation issue

J

julien

Hello,
I have 2 classes in the same namespace:

using System;
using System.Collections;

public class PluginInformation
{
[...]

public PluginInformation(string filename)
{
// constructor
}
}

---------------------
using System;

public class PluginStructure: PluginInformation
{
[...]

public PluginStructure(string filename)
{
new PluginInformation(filename);
}

public PluginStructure()
{
//new PluginInformation();
}
}

When I compile these 2 classes, I got the error:
e:\code\PluginStructure.cs(44,10): error CS1501: No overload for method
'PluginInformation' takes '0' arguments

e:\code\PluginInformation.cs(17,10): (Location of symbol related to
previous error)

I tried to modify the constructors in PluginStructure (the first one
only, the second one only). But the error message is always the same (on
the line number changes), and it doesn't make sense for me:
PluginInformation doesn't have a constructor with 0 argument.

Any idea?

Thanks
Julien
 
J

Jon Skeet [C# MVP]

julien said:
I have 2 classes in the same namespace:

I tried to modify the constructors in PluginStructure (the first one
only, the second one only). But the error message is always the same (on
the line number changes), and it doesn't make sense for me:
PluginInformation doesn't have a constructor with 0 argument.

The problem is that PluginStructure is trying to implicitly call
base(), and there's no such constructor.

See http://www.pobox.com/~skeet/csharp/constructors.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top