Click here to Skip to main content
14,869,990 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
frends , i had very basic doubt please clear.

if an interface inherits another interface which contain one method.
compiler not asking to implement second interface why.

interface IInterface222
        void GetData();

  public interface IInterface23 : IInterface222


why this is allowing with out implementing.

iam aware that interfaces does not contain the definitions this is only reason behind? a
Updated 16-Dec-13 1:43am
johannesnestler 16-Dec-13 8:17am
you are not implementing the Interface, you just declared an inherited one. implementation is done on a class - and of course compiler will complain if your GetData method isn't there.

1 solution

Because IInterface222 implementation accomplishes IInterface23 implementation too.
rajacsharp5 16-Dec-13 8:01am
your telling ,subclass which inherits IInterface23 and do implementation ?
CPallini 16-Dec-13 8:08am
Yes, if you have
class Foo : IInterface23
and Foo implements GetData()
BTW what an unfortunate name for a void method.
rajacsharp5 26-Dec-13 2:35am
public void GetData(){
Console.Write("some text");
You can extend an interface to add new methods or members. In the new interface definition, use the colon operator followed by the name of the original interface. This is very similar to derivation in classes.
The extended interface subsumes the original interface, so any class that implements the extended interface must also implement the original interface as well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900