I have this virtual method in my base class:
public virtual bool AgregarEtapa(DateTime pFechaIngreso, EtapaEnvio.Etapas pEtapa, OficinaPostal pUbicacion, string pNombreRecibio, out string pMensajeError)
{
string mensajeError = "";
bool sePuedeAgregar = false;
// more code
pMensajeError = mensajeError;
return sePuedeAgregar;
}
and a method that overrides it in a child class, like this:
public override bool AgregarEtapa(DateTime pFechaIngreso, EtapaEnvio.Etapas pEtapa, OficinaPostal pUbicacion, string pNombreRecibio, out string pMensajeError)
{
bool seHace = true;
bool exito = false;
// more code here
if (seHace)
{
base.AgregarEtapa(pFechaIngreso, pEtapa, pUbicacion, pNombreRecibio, out pMensajeError);
exito = true;
pMensajeError = ??;
}
return exito;
}
I've never worked with out parameters in overriden methods, so I'm not sure how to declare the out parameter of the child method. I suppose that both out parameters (child and base) should be called the same way, but i'm not sure about this either.
Basically, I need to set pMensajeError
in the child method with the same value returned by the out parameter of the base method.
How should this work?