Ive inherited some code that are a regular class with some private static methods in them. The code (pseudo code) looks like this
public class Animal
{
private string typeOfAnimal;
public Animal(string typeOfAnimal)
{
this.typeOfAnimal = typeOfAnimal;
}
public void MakeSound()
{
var sound = Animal.GetSound(typeOfAnimal);
// Make use of sound here
}
private static string GetSound(string typeOfAnimal)
{
if(typeOfAnimal == "dog")
return "bark";
else if(typeOfAnimal == "cat")
return "mjau";
}
}
Is there any benefit in doing like this compared to making GetSound a regular instance method?