Frequently Asked Interview Questions

Consider a scenario, class which is implemented two interfaces with same method name in it

Please answer the following questions.

  • Will it be an Issue? No
  • Do I need to implement two different Add () methods? If yes how can you implement in derived class?Yes, we need to provide the implementation for two Add() methods by prefixing Interface name to method name. The implementation would be like this:Interface1.Add() {------} and Interface2.Add() {-----}
  • How can you access a specific Add() method of a class?

    Interface1 obj1= new Derrivedclass();
    Obj1.Add() //Invoke the Interface1.Add() Method.


    Interface2 obj2= new Derrivedclass();
    Obj2.Add() //Invoke the Interface2.Add() Method.

Most Visited Pages

Home | Site Index | Contact Us