I apologize if this DOES exist somewhere in other questions asked about this error, but I’ve looked through TONS and I’m still thrown. So I’m getting ye old “…is inaccessible due to it’s protection level” error. When this error shows up so does another error, which I think is the real crux of the matter. I get “SS.Spreadsheet” has no constructors defined, which means I’m probably not implementing my constructor inherited from the Abstract class correctly. Or something along those lines.
public abstract class AbstractSpreadsheet
{
public Func<string, bool> IsValid { get; protected set; }
public Func<string, string> Normalize { get; protected set; }
public string Version { get; protected set; }
public AbstractSpreadsheet(Func<string, bool> isValid, Func<string, string> normalize, string version)
{
this.IsValid = isValid;
this.Normalize = normalize;
this.Version = version;
}
...
}
My class:
class Spreadsheet : AbstractSpreadsheet
{
public Spreadsheet()
: base(v => true, s => s, "default")
{
}
...
}
I’ve also tried something along the lines of :
public Spreadsheet()
: base(v => true, s => s, "default")
{
IsValid = v => true;
Normalize = s => s;
Version = "default";
}
Based on answers I’ve seen on here. But still nothing (and given my understanding this wouldn’t work anyway).
The abstract class was given to me and cannot be changed.
Do I need to implement IsValid, Normalize, and Version override style methods in my Spreadsheet class? Or something to that effect…. If so, how?
I’m still quite new to the world of programming and very new to C#, so if anyone can even give me a shove in the right direction, I would really appreciate it.
Since everything in your example is public, the error probably applies to the class itself. Try making the Spreadsheet class public, and see if it fixes the error.