0
Method that calls other method based on input
Is there a way to create a method that takes input and calls other methods depending on the input, other than static void Test(string A) { if (A==āAttackā) { Attack(); } ........ } And static void Test(string A) { switch(A) { case āAttackā: Attack(); break; } ........ } Iām trying to make an OOP game for practice and Iāve seen a guy make it using a pretty interesting way using Python so wondering if thereās a C# version of the method. https://code.sololearn.com/c2Mbsk99oqsM/?ref=app Line 96 is where the guy creates the method that takes input.
1 Answer
+ 1
Use function polymorphism...C++/C#