I'm creating an error in C # that should extend the class Exception
, but should also add an extra property, like this:
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)
{
}
}
Can I call the base class constructor Exception
and also call the simplest constructor in my class CampoVazioErro(object c)
? To my understanding there must be some way to do this but I'm not finding it on the internet.
Note: I know that to call another constructor within the same class I just have to pass
this()
in front of another constructor (egCampoVazioErro(object c, string m): this(c)
but I have no idea how to call this and also the constructor of my superclass.
A little help please?