C#: Abstract classes need to implement interfaces?
Posted
by bguiz
on Stack Overflow
See other posts from Stack Overflow
or by bguiz
Published on 2010-04-24T16:12:51Z
Indexed on
2010/04/25
4:43 UTC
Read the original article
Hit count: 291
My test code in C#:
namespace DSnA
{
public abstract class Test : IComparable
{
}
}
Results in the following compiler error:
error CS0535: 'DSnA.Test' does not implement interface member
'System.IComparable.CompareTo(object)'
Since the class Test
is an abstract class, why does the compiler require it to implement the interface? Shouldn't this requirement only be compulsory for concrete classes?
© Stack Overflow or respective owner