Wednesday, April 18, 2012

C#, Using Interface

I'm trying to use Interface class and I have a question about Interface method parameters.



I have an Interface class to make child class use specific method.
but the child classes need different number of parameters for the method.



Example,



public interface IPayment
{
void MakePayment();
}


and define the MakePayment method in child classes.



public class PayPay : IPayment
{
public void MakePayment(string a); // it needs only one parameter
}

public class Google : IPayment
{
public void MakePayment(string a, int b); // it needs two parameters.
}


Like above case, How can I modify my interface class?



Thank you!





No comments:

Post a Comment