Pavan Satpute
Can I inherit one Interface from another Interface?If Yes How? If No Why?

If I have below Code

  1. public interface ItestA
  2. {
  3. void method1();
  4. }
  5. public interface ItestB : ItestA
  6. {
  7. void method2();
  8. }
By Pavan Satpute in C# on Sep 12 2019
  • Ishoo Anyal
    Oct, 2019 7

    Yes you can inherit one interface from another without implementing the method of inherited interface however once Say you have two interface IA and IB So you can do interface IA : IB {} without any problem, however when you inherit IA in some class then you need to implement methods of IA as well as IB

    • 3
  • ramila raj
    Nov, 2019 8

    yes..because interface it not having method definition, once you inherited the inherited class will override all the methods inside the can check my youtube page for more interview questions like this..

    • 1
  • Sagar Raj
    Dec, 2019 22

    Yes you can Inherit one Interface from another Interface Basically interface will contain only constant varible and abstract method so when you inherit you need to provide implementation for the abstract method.For example
    interface car{
    abstract drive();
    interface maruthi(brand name): car{
    abstract safety();
    //here drive method will also be there and safety method will also be there now the class which implents the maruthi interface need to provide implementation for drive and safety

    • 0
  • Rahul singh
    Dec, 2019 10

    public interface ICollection : IEnumerable, IEnumerable

    • 0
  • Shekhar Kumar
    Nov, 2019 26

    Yes, one interface can inherit another interface.
    Now when ItestB gets inherited by a class then that class has to implement the methods of both interfaces.

    • 0
  • Yogesh Sevankar
    Oct, 2019 18


    • 0

Most Popular Job Functions