0
I am creating a C# error that should extend the class Exception
but, should also add an extra property, thus:
public class CampoVazioErro: Exception
{
public string campo { get; }
public CampoVazioErro(object c)
{
campo = c;
}
public CampoVazioErro(object c, string m) : base(m)
{
}
public CampoVazioErro(object c, string m, Exception i) : base(m, i)
{
}
}
Is it possible I call the base class builder Exception
and also call the simplest builder in my class CampoVazioErro(object c)
? In my opinion there must be some way to do this but I’m not finding on the internet.
Note: I know to call another builder within the same class I just have to pass the
this()
in front of another manufacturer (ex:CampoVazioErro(object c, string m): this(c)
but I have no idea what to call it and also the builder of my superclass.
You would have to call the "simple" builder of your class with the
: this(c)
and then the simple constructor would have called the base constructor using the: base()
– Jonathan Barcela