static void Main(string[] args) { Itaxtogov[] tax = new Itaxtogov[2]; tax[0] = new myindia(); tax[1] = new myeurope(); for (int i = 0; i < tax.Length; i++) { tax[i].paytax(10000); } Console.ReadLine(); }
public static void perform(Itaxtogov ob) { ob.paytax(50000); }
//Q5. Create a interface Itaxtogov with method void paytax(double amt). // Create a class myindia, myeurope let this class implement this interface. // In class myindia paytax method will print tax amount which is 40% of the data passed in method. // In class myeurope paytax method will print tax amount which is 30% of the data passed in method. public static void calculateTax(Itaxtogov interfaceref, double amt) { interfaceref.paytax(amt); }