question about extending and combining interfaces


F

Flip

I'm looking at the O'Reilly Programming C# book and I have a question about
extending and combining interfaces syntax. It just looks a bit odd to me,
the two syntaxes look identical, but how does C# know which is extending and
which is combining?

interface IStorable{
void Read();
void Write(object o);
}

interface ICompressible{
void LogSavedBytes();
}

interface IStorableCompressible : IStoreable, ICompressible{
void LogOriginalSize();
}

This appears on the surface to be extending multiple interfaces? I thought
you couldn' do that in C#? Maybe I'm just confused, sorry. Help.
 
Ad

Advertisements

J

Jon Skeet [C# MVP]

Flip said:
I'm looking at the O'Reilly Programming C# book and I have a question about
extending and combining interfaces syntax. It just looks a bit odd to me,
the two syntaxes look identical, but how does C# know which is extending and
which is combining?

interface IStorable{
void Read();
void Write(object o);
}

interface ICompressible{
void LogSavedBytes();
}

interface IStorableCompressible : IStoreable, ICompressible{
void LogOriginalSize();
}

This appears on the surface to be extending multiple interfaces? I thought
you couldn' do that in C#? Maybe I'm just confused, sorry. Help.
C# allows multiple inheritence of interface, just not implementation.
 
P

Paul E Collins

Flip said:
interface IStorableCompressible :
IStoreable, ICompressible{
void LogOriginalSize();
}
This appears on the surface to be extending
multiple interfaces? I thought you couldn' do
that in C#?
C# permits multiple inheritance from interfaces, but not from classes.

P.
 
Ad

Advertisements

F

Flip

Thanks for the heads up Jon and Paul. I'll be reading more into this on the
weekend! :>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top