If I have below Code
public interface ItestA{ void method1();}public interface ItestB : ItestA{ void method2();}
public interface ItestA
{
void method1();
}
public interface ItestB : ItestA
void method2();
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
using System;public interface A{ void mymethod1(); void mymethod2();}
public interface B : A{ void mymethod3();}
class Test : B{ public void mymethod1() { Console.WriteLine(“Implement method 1”); } public void mymethod2() { Console.WriteLine(“Implement method 2”); } public void mymethod3() { Console.WriteLine(“Implement method 3”); }}class Program{ static void Main(String[] args) { Test obj = new Test(); obj.mymethod1(); obj.mymethod2(); obj.mymethod3(); }}
yes..because interface it not having method definition, once you inherited the inherited class will override all the methods inside the inheritance..you can check my youtube page for more interview questions like this..
https://www.youtube.com/channel/UC3NEDQLo6r544wagWGWPGLg
Yes you can inherit one interface in another. However, when you implement the interface which has inherited another interface, you would have to implement the methods in both interfaces.
Yes, We can inherit one interface from another interface. Later class that implements parent interface has to implement methods from child interface and parent interface. Example snippet: public class Test : ITest{public int sum(){throw new NotImplementedException();}public int sum1(){throw new NotImplementedException();}}public interface ITest1{int sum1(); }public interface ITest:ITest1{int sum();}
You can't inherited because there is no inheritance concept this is Implementation .
jnj
Yes, We one Interface can inherit from another interface and the class which inherit the interface must have to provide the implementation of the full chain inheritance.
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 exampleinterface 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}
public interface ICollection : IEnumerable, IEnumerable
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.
Yes