mardi 19 janvier 2021

How to Reuse code in two similar function in C#? [duplicate]

I have two methods defined in two classes. These methods are almost the same. Instead of these two methods I want to use only one in the abstract class but the problem is that every of these two methods is calling different method and that is only difference between this two methods.

public class Perk
{
  public void Method()
  {
     //some code goes here
     Method1();
  }
} 

public class Jerk
{
  public void Method()
  {
     //some code goes here
     Method2();
  }
} 

Aucun commentaire:

Enregistrer un commentaire