Hard to understand exactly what this question is driving at, but I'm guessing you are wanting the syntax for having one base method in an abstract class.
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.
I took what you said about only wanting to use 1 method in the abstract class literally. The below example here shows one method in the abstract class... However, there is also a very confusing next sentence. I took it to mean you wanted to use polymorphism so that you could call Perk.Method(), Jerk.Method(). Each class, Perk and Jerk having a different implementation. Obviously, there is much confusion around this post :)
public abstract class BaseAbstractClass {
public abstract void Method();
}
public class FirstClass : BaseAbstractClass {
public override void Method() {
throw new System.NotImplementedException();
}
}
public class SecondClass : BaseAbstractClass {
public override void Method() {
throw new System.NotImplementedException();
}
}
If this is not the right interpretation, and you want to just have one method in an abstract class that is implemented exactly the same for both Perk & Jerk class, don't make the method abstract, just implement it in the abstract class.
public abstract class BaseAbstractClass {
public abstract void Method();
}
public class FirstClass : BaseAbstractClass {
// Method is on the base class
}
public class SecondClass : BaseAbstractClass {
// Method is on the base class
}