Subhrat Singh

Subhrat Singh

  • 1.7k
  • 36
  • 1.4k

Which interface's method Add2values(param 1, param 2) will be called?

Dec 6 2023 2:31 PM
// interface 1 public interface IStudents { public int Add2values(int a, int b); } // interface 2 public interface IStudents2 { public int Add2values(int a, int b); } //class inherit 2 interfaces public class Students : IStudents, IStudenst2 { public int Add2values(int a, int b) { return a+b; } } // in home controller public IActionResult Index() { Students students = new Students(); int res = students.Add2values(20, 30); return View(); } // the question is interface IStudensts or IStudenst2 will be called to calculate the sum? Thanks and will be appreciated?

Answers (2)