question about extending and combining interfaces

  • Thread starter Thread starter Flip
  • Start date Start date
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.
 
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.
 
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.
 
Thanks for the heads up Jon and Paul. I'll be reading more into this on the
weekend! :>
 
Back
Top