Zee
Zee
Explore posts from servers
CC#
Created by Zee on 8/6/2023 in #help
❔ is there a way for a method to have interchangeable parameter?
is there a way for a method to have interchangeable parameter depending on when I call it? so I have this method
public void DrankHealthBoost(Health_Boost potion)
{
health += 1;
}
public void DrankHealthBoost(Health_Boost potion)
{
health += 1;
}
this method has a parameter of type Health_Boost and when I call it I do this
private void CollectHealthPot(Health_Boost potion, Player pl)
{
pl.DrankHealthBoost(potion);

}
private void CollectHealthPot(Health_Boost potion, Player pl)
{
pl.DrankHealthBoost(potion);

}
is there a way I can change the DrankHealthBoost(Health_Boost potion) parameter so I can do something like this
private void CollectHealthPot(Shop potion, Player pl)
{
pl.DrankHealthBoost(potion);

}
private void CollectHealthPot(Shop potion, Player pl)
{
pl.DrankHealthBoost(potion);

}
so have the parameter to be of type class shop
16 replies