I have an array of Pokemons. Pokemons have an abstract method vitesse(vitesse = speed in french), which change depending of the type of pokemon.
I also have a class TabPokemon which generate my array of pokemons. In this class I want to calculate the fastest pokemon.
This is my method :
public Pokemon plusRapide()
{
    Pokemon winner;
    double vitesse = 0.0;
    foreach(Pokemon p in tab)
    {
        if(p.vitesse()> vitesse)
        {
            vitesse = p.vitesse();
            winner = p;
        }
    }
    return winner;
}
It shows me an error on the return statement because it is assigned locally. How can I return the object Pokemon with the greatest speed value?
 
     
    