Handling objects that inherit from a class

0

Hello, I am in the development of a program where I have to manage the users in a single logic, I have two types of user, Administrator and Reader, my problem is when I want to find a type that is of the other type, it generates the error that Can not convert from the reader type to the admin type as I do to put a brake and know what type it is? I leave the code that I have many thanks.

public Usuario BuscarUsuario(int pCi)
{        
    Usuario unUsu;        
    unUsu = FabricaPersistencia.getPersitenciaAdministrador().BuscarAdministrador(pCi);

    if (unUsu == null) 
    {
        unUsu = FabricaPersistencia.getPersitenciaLector().BuscarLector(pCi);
    }
    return unUsu;
}
    
asked by Alexis Mendez 04.07.2017 в 23:57
source

0 answers