<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Why does an abstract class need to implement interface methods?</title>
	<atom:link href="http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/feed/" rel="self" type="application/rss+xml" />
	<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=why-does-an-abstract-class-need-to-implement-interface-methods</link>
	<description></description>
	<lastBuildDate>Tue, 07 May 2013 21:45:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Arash</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-35</link>
		<dc:creator>Arash</dc:creator>
		<pubDate>Tue, 23 Jun 2009 04:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-35</guid>
		<description>Thanks very much. I&#039;m new to C# (I&#039;m primarily a Java dev) and I spent half an hour hour tweaking my interface, abstract class and concrete class until it compiled. Wanting to know why this craziness was required I was lucky enough to find your page through google.

Thank you for the explanation!</description>
		<content:encoded><![CDATA[<p>Thanks very much. I&#8217;m new to C# (I&#8217;m primarily a Java dev) and I spent half an hour hour tweaking my interface, abstract class and concrete class until it compiled. Wanting to know why this craziness was required I was lucky enough to find your page through google.</p>
<p>Thank you for the explanation!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicolas Buduroi</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-27</link>
		<dc:creator>Nicolas Buduroi</dc:creator>
		<pubDate>Thu, 04 Dec 2008 20:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-27</guid>
		<description>Really great explanation, thanks!</description>
		<content:encoded><![CDATA[<p>Really great explanation, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Li</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-25</link>
		<dc:creator>Raymond Li</dc:creator>
		<pubDate>Thu, 02 Oct 2008 04:20:35 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-25</guid>
		<description>@Joonas: Thanks for the feedback!

@Dave: I think Shafqat put it best.  Instead of having a default for making the method virtual like in Java, the developer is left to make the decision in C#.  Maybe a default makes sense, but then the question of whether it should be virtual or non-virtual comes up.  C# (like C++) methods are non-virtual by default.  Why should there be an exception for interface methods in an abstract class?</description>
		<content:encoded><![CDATA[<p>@Joonas: Thanks for the feedback!</p>
<p>@Dave: I think Shafqat put it best.  Instead of having a default for making the method virtual like in Java, the developer is left to make the decision in C#.  Maybe a default makes sense, but then the question of whether it should be virtual or non-virtual comes up.  C# (like C++) methods are non-virtual by default.  Why should there be an exception for interface methods in an abstract class?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shafqat Ahmed</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-24</link>
		<dc:creator>Shafqat Ahmed</dc:creator>
		<pubDate>Tue, 30 Sep 2008 22:21:29 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-24</guid>
		<description>This is probably to make you decide at the abstract class if the method implementation can be made virtual (overridable) or you are providing an implementation of the interface method in the abstract class that can overridden at the child or sealed at the abstract class.</description>
		<content:encoded><![CDATA[<p>This is probably to make you decide at the abstract class if the method implementation can be made virtual (overridable) or you are providing an implementation of the interface method in the abstract class that can overridden at the child or sealed at the abstract class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-23</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 30 Sep 2008 13:53:11 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-23</guid>
		<description>An interface method is virtual by definition.  In fact, all an interface is, is an abstract class with nothing but abstract methods and properties, which are also virtual by definition.  (A bit over simplified, but not much.)

Therefore, IMO, you are correct to assume this is an oversite in the language implementation.

Even if the IL code needs the method stubbed out for some technical reason, the compiler should hide this fact from the programmer.

While you are correct that you might override the methods and make them abstract, this would be unusual and while it should be allowed, it does not explain the requirement to define it in the abstract class.</description>
		<content:encoded><![CDATA[<p>An interface method is virtual by definition.  In fact, all an interface is, is an abstract class with nothing but abstract methods and properties, which are also virtual by definition.  (A bit over simplified, but not much.)</p>
<p>Therefore, IMO, you are correct to assume this is an oversite in the language implementation.</p>
<p>Even if the IL code needs the method stubbed out for some technical reason, the compiler should hide this fact from the programmer.</p>
<p>While you are correct that you might override the methods and make them abstract, this would be unusual and while it should be allowed, it does not explain the requirement to define it in the abstract class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joonas Koivunen</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-22</link>
		<dc:creator>Joonas Koivunen</dc:creator>
		<pubDate>Tue, 30 Sep 2008 13:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-22</guid>
		<description>Great job writing this article, this has to be very confusing to Java people who also have to write C# -- at least it was for me when I first started implementing interfaces with abstract base classes. 

At first it is rather strange but then again it might steer people to write basic implementation methods which make sure for example that the conditions on calling the method (argument not null, etc.) are met, and only then call some abstract (virtual) method named the same expect for an &quot;Internal&quot; prefix.

Perhaps more discussion on how aren&#039;t Java&#039;s final methods essentially (user-wise, not necessarily implementation wise) the same as non-virtual C# methods. 

Yes those &quot;seal&quot; the method from being overridden in any child class but there&#039;s also the possibility of marking classes or packages as sealed.

In C# I believe you can still provide a &quot;new&quot; method, even if the &quot;previous&quot; implementation has been marked as non-virtual. This is very confusing I think, as you need to have a full reference to the class implementing this method marked as &quot;new&quot; in order to use it.</description>
		<content:encoded><![CDATA[<p>Great job writing this article, this has to be very confusing to Java people who also have to write C# &#8212; at least it was for me when I first started implementing interfaces with abstract base classes. </p>
<p>At first it is rather strange but then again it might steer people to write basic implementation methods which make sure for example that the conditions on calling the method (argument not null, etc.) are met, and only then call some abstract (virtual) method named the same expect for an &#8220;Internal&#8221; prefix.</p>
<p>Perhaps more discussion on how aren&#8217;t Java&#8217;s final methods essentially (user-wise, not necessarily implementation wise) the same as non-virtual C# methods. </p>
<p>Yes those &#8220;seal&#8221; the method from being overridden in any child class but there&#8217;s also the possibility of marking classes or packages as sealed.</p>
<p>In C# I believe you can still provide a &#8220;new&#8221; method, even if the &#8220;previous&#8221; implementation has been marked as non-virtual. This is very confusing I think, as you need to have a full reference to the class implementing this method marked as &#8220;new&#8221; in order to use it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Wood</title>
		<link>http://rayli.net/blog/2008/09/why-does-an-abstract-class-need-to-implement-interface-methods/comment-page-1/#comment-21</link>
		<dc:creator>John Wood</dc:creator>
		<pubDate>Tue, 30 Sep 2008 13:18:45 +0000</pubDate>
		<guid isPermaLink="false">http://rayli.net/blog/?p=77#comment-21</guid>
		<description>Thanks for the explanation.  Pretty reasonable guess if you ask me.</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation.  Pretty reasonable guess if you ask me.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
