Reputation: 3
I have searched very much about this question. There are many ways which are explained but they have not been usable for me.
I have this class:
public class ArcHydro : Oatc.OpenMI.Sdk.Backbone.LinkableComponent
{
public void Initialize(Argument[] properties)
{
_timeStamps = new ArrayList();
_culture = CultureInfo.CurrentCulture.NumberFormat;
_links = new Hashtable();
readArcHydro();
}
}
Which inherits this class
namespace Oatc.OpenMI.Sdk.Backbone
{
public abstract void Initialize(IArgument[] properties);
}
The error is
`'CUAHSI.OpenMI.ArcHydro' does not implement inherited abstract member
'Oatc.OpenMI.Sdk.Backbone.LinkableComponent.Initialize(OpenMI.Standard.IArgument`[])'`
How can I solve it? I used override before class but the error remains.
Upvotes: 0
Views: 3685
Reputation: 11521
The signature of the implemented method should be exactly the same as the abstract one. Therefore you should have it like this:
public override void Initialize(IArgument[] properties)
{
...
}
Please pay attention that your input arguments should be from type IArgument[] which you have mentioned in your abstract class and remember to mark it as override
Follow the example on Microsoft
Upvotes: 0
Reputation: 11
Your implementation function should have the "override" keyword, and the same arguments.
public override void Initialize(IArgument[] properties)
{
//...
}
Upvotes: 1
Reputation: 14640
You have two problems. You should be implementing:
public abstract void Initialize(IArgument[] properties);
but you're implementing:
public void Initialize(Argument[] properties);
// --------------------^ Notice the missing 'I'.
Secondly, you're missing the override
keyword. So your class should look like this:
public class ArcHydro : Oatc.OpenMI.Sdk.Backbone.LinkableComponent
{
public override void Initialize(IArgument[] properties)
{
_timeStamps = new ArrayList();
_culture = CultureInfo.CurrentCulture.NumberFormat;
_links = new Hashtable();
readArcHydro();
}
}
Upvotes: 4