kalit sikka
Multiple Interfaces with same Method
By kalit sikka in Windows Forms on Jul 03 2009
  • Rajanikant Hawaldar
    Oct, 2022 13

    1. interface G1 {
    2. // method declaration
    3. void mymethod();
    4. }
    5. interface G2 {
    6. // method declaration
    7. void mymethod();
    8. }
    9. // Geeks implements both
    10. // G1 and G2 interface
    11. class Geeks : G1, G2
    12. {
    13. // Here mymethod belongs to
    14. // G1 interface
    15. void G1.mymethod()
    16. {
    17. Console.WriteLine("GeeksforGeeks");
    18. }
    19. // Here mymethod belongs to
    20. // G2 interface
    21. void G2.mymethod()
    22. {
    23. Console.WriteLine("GeeksforGeeks");
    24. }
    25. }

    • 0
  • Priyaranjan Pati
    Aug, 2009 13

     To show what happens to the possible conflicts if you 
     implement multiple interfaces: there are no conflicts.


     If multiple interfaces have the exact same method, you
     merely have to implement it.


     If multiple interfaces have similar methods, you must
     implement them all.There's still no conflict.

    • 0
  • P Narasimha
    Jul, 2009 17

    Hi ,

    Same Method in Both the Interface u just Impliment the One Interface that it.ok i will give with examples later.ok bye

     

    • 0
  • kalit sikka
    Jul, 2009 3

    We have two Interface A and B both have one method common in them i.e. GetCustomer(), Suppose if Class C will implement both the interfaces than what will be the implications of Common Method on it.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS