compilation issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • julien

    compilation issue

    Hello,
    I have 2 classes in the same namespace:

    using System;
    using System.Collecti ons;

    public class PluginInformati on
    {
    [...]

    public PluginInformati on(string filename)
    {
    // constructor
    }
    }

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

    public class PluginStructure : PluginInformati on
    {
    [...]

    public PluginStructure (string filename)
    {
    new PluginInformati on(filename);
    }

    public PluginStructure ()
    {
    //new PluginInformati on();
    }
    }

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

    e:\code\PluginI nformation.cs(1 7,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:
    PluginInformati on doesn't have a constructor with 0 argument.

    Any idea?

    Thanks
    Julien
  • Jon Skeet [C# MVP]

    #2
    Re: compilation issue

    julien <julien@sobrier .net> wrote:[color=blue]
    > I have 2 classes in the same namespace:[/color]

    <snip>
    [color=blue]
    > 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:
    > PluginInformati on doesn't have a constructor with 0 argument.[/color]

    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

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • julien

      #3
      Re: compilation issue

      Jon Skeet [C# MVP] wrote:[color=blue]
      > See http://www.pobox.com/~skeet/csharp/constructors.html
      >[/color]
      Thanks a lot for the URL, it answers my question.

      Julien

      Comment

      Working...