<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<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">
	<channel>
		<title>冒号论坛 &#187; Tag: inheritance - Recent Posts</title>
		<link>http://bbs.zhenghui.org/tags/inheritance</link>
		<description>冒号论坛 &raquo; Tag: inheritance - Recent Posts</description>
		<language>en-US</language>
		<pubDate>Wed, 08 Sep 2010 13:17:55 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://bbs.zhenghui.org/search.php</link>
		</textInput>
		<atom:link href="http://bbs.zhenghui.org/rss/tags/inheritance" rel="self" type="application/rss+xml" />

		<item>
			<title>hui on "subtype和subclass"</title>
			<link>http://bbs.zhenghui.org/topic/subtype%e5%92%8csubclass#post-138</link>
			<pubDate>Thu, 24 Jun 2010 11:22:07 +0000</pubDate>
			<dc:creator>hui</dc:creator>
			<guid isPermaLink="false">138@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;是的，CiteSeerx有大量高质量的学术文章。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "subtype和subclass"</title>
			<link>http://bbs.zhenghui.org/topic/subtype%e5%92%8csubclass#post-137</link>
			<pubDate>Thu, 24 Jun 2010 10:51:55 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">137@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;CiteSeer是个好地方！
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "subtype和subclass"</title>
			<link>http://bbs.zhenghui.org/topic/subtype%e5%92%8csubclass#post-132</link>
			<pubDate>Mon, 14 Jun 2010 17:40:53 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">132@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;是的，和《冒号课堂》的观点基本一致。区分了subtype和subclass就能把继承和多态的关系理清楚了。同时，对于以前不太容易区分的interface与abstract class的选择问题也会更清楚。使用interface是为了subtype，使用abstract class则包含了subtype和subclass。记得书中比喻abstract class是半成品。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hui on "subtype和subclass"</title>
			<link>http://bbs.zhenghui.org/topic/subtype%e5%92%8csubclass#post-131</link>
			<pubDate>Mon, 14 Jun 2010 00:36:52 +0000</pubDate>
			<dc:creator>hui</dc:creator>
			<guid isPermaLink="false">131@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;非常好的文章，多谢分享。其中谈到subclass与subtype的区别时是这样说的：Subclasses allow one to reuse the code inside classes - both instance variable declarations and method definitions. Thus they are useful in supporting code reuse inside a class. Subtyping on the other hand is useful in supporting reuse externally, giving rise to a form of polymorphism。即：子类用于类的内部重用，子类型用于外部重用。这个与《冒号课堂》中提到的观点本质上是一致的：实现继承消费可重用的旧代码，接口继承生产可重用的新代码；接口继承不是为了代码重用，而是为了代码被重用。&#60;/p&#62;
&#60;p&#62;另：该文章的PDF版可到 &#60;a href=&#34;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.9.7539&#38;amp;rep=rep1&#38;amp;type=pdf&#34; rel=&#34;nofollow&#34;&#62;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.9.7539&#38;amp;rep=rep1&#38;amp;type=pdf&#60;/a&#62; 下载。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "subtype和subclass"</title>
			<link>http://bbs.zhenghui.org/topic/subtype%e5%92%8csubclass#post-130</link>
			<pubDate>Mon, 14 Jun 2010 00:13:36 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">130@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;虽然subtype和subclass是OOP中最基本的问题之一，但我是在读《冒号课堂》的时候才开始注意到这个问题。我想国内的程序员不能区分subtype和subclass的不在少数。下面这个资料对于subtype和subclass讨论得比较深入，贴上来分享：&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.cs.princeton.edu/courses/archive/fall98/cs441/mainus/mainus.html&#34; rel=&#34;nofollow&#34;&#62;http://www.cs.princeton.edu/courses/archive/fall98/cs441/mainus/mainus.html&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-107</link>
			<pubDate>Wed, 05 May 2010 10:22:57 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">107@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;看到一篇相关文章：&#60;br /&#62;
&#60;a href=&#34;http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Non-copyable_Mixin&#34; rel=&#34;nofollow&#34;&#62;http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Non-copyable_Mixin&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hui on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-63</link>
			<pubDate>Sun, 21 Feb 2010 23:47:15 +0000</pubDate>
			<dc:creator>hui</dc:creator>
			<guid isPermaLink="false">63@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;&#38;gt;&#38;gt;noncopyable不是接口，但却达到了接口类似的特征表达效果，与C#中可序列化类的标记[Serializable]有异曲同工之妙。&#60;/p&#62;
&#60;p&#62;是的，书中p307提到的标记接口和属性导向式编程（@OP）正适合那些无法用接口直接表征的类型特性。这在Java和C#中比较常见，而在C++中除noncopyable这种特殊用法外并不多见，一个明显的原因是前二者对metadata有更强大的支持。&#60;/p&#62;
&#60;p&#62;&#38;gt;&#38;gt;接口是有主客关系的，类的这种行为&#34;特征&#34;不一定需要客户的存在。不知道这种表达“特征”而不涉及客户接口的方式就是mixin或者traits是否有关联？ &#60;/p&#62;
&#60;p&#62;这话恐怕不太准确。如果没有客户的存在，也就谈不上是否copyable了。而无论是mixin还是trait，都提供了一系列接口集合，它们与通常的抽象类型中interface的一个主要区别是除接口外还提供了实现；与abstract class的一个主要区别是摆脱了class hierarchy的桎梏。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hui on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-62</link>
			<pubDate>Sun, 21 Feb 2010 23:18:44 +0000</pubDate>
			<dc:creator>hui</dc:creator>
			<guid isPermaLink="false">62@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;&#38;gt;&#38;gt;noncopyable的原理从继承的角度看是通过基类对派生类产生约束而实现不可拷贝的效果的。我把这种方式称为“继承约束”，它与实现继承的“继承功能”和mixin的“混入功能”就显得有些不同。一个注重约束，一个注重功能。 &#60;/p&#62;
&#60;p&#62;你的这种说法有一定道理，但仅限于noncopyable这类特殊用法，其他的非公开继承（书中p241中提到的protected inheritance与private inheritance）还是注重功能而非约束的。当然，如果把约束看作一种特殊的功能（不妨称之为“负功能”？），它们又可以统一了。&#60;/p&#62;
&#60;p&#62;此外，书中提到noncopyable类似mixin的地方有一个关键处，即noncopyable类本身具有抽象性（因为一个单纯的noncopyable对象是毫无意义的——无论是语法上还是语义上），故可看作抽象类型（尽管不是严格语法意义上的抽象类型）。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-61</link>
			<pubDate>Sun, 21 Feb 2010 21:30:30 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">61@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;noncopyable例子还有一个有趣的地方。一般来讲，一个类的功能特征是通过接口抽象（还包括数据抽象）来体现，但“不可拷贝”是无法对应到一个接口的！noncopyable不是接口，但却达到了接口类似的特征表达效果，与C#中可序列化类的标记[Serializable]有异曲同工之妙。&#60;/p&#62;
&#60;p&#62;我思考以后认为：接口是有主客关系的，类的这种行为&#34;特征&#34;不一定需要客户的存在。不知道这种表达“特征”而不涉及客户接口的方式就是mixin或者traits是否有关联？
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-60</link>
			<pubDate>Sun, 21 Feb 2010 21:06:19 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">60@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;书中的确讲到了，看的时候这部分没有留下很深的印象。&#60;/p&#62;
&#60;p&#62;p297讲“本质上看是一种类似mixin功能的抽象类型”。我认为这是一种另类继承的原因在于：noncopyable的原理从继承的角度看是通过基类对派生类产生约束而实现不可拷贝的效果的。我把这种方式称为“继承约束”，它与实现继承的“继承功能”和mixin的“混入功能”就显得有些不同。一个注重约束，一个注重功能。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>hui on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-53</link>
			<pubDate>Sat, 20 Feb 2010 21:59:47 +0000</pubDate>
			<dc:creator>hui</dc:creator>
			<guid isPermaLink="false">53@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;你说的这种继承和boost::nocopyable书中分别在p241和p297中已经介绍过了，它们属于仅继承实现而不继承接口的继承。C++支持这种用法，但Java和C#不支持。
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Todd on "另类继承"</title>
			<link>http://bbs.zhenghui.org/topic/%e5%8f%a6%e7%b1%bb%e7%bb%a7%e6%89%bf#post-52</link>
			<pubDate>Sat, 20 Feb 2010 21:31:36 +0000</pubDate>
			<dc:creator>Todd</dc:creator>
			<guid isPermaLink="false">52@http://bbs.zhenghui.org/</guid>
			<description>&#60;p&#62;书中继承机制部分介绍了实现继承和接口继承，但感觉还有另一种继承的用法可以说的。比如boost::nocopyable就是利用了C++基类的私有拷贝构造函数防止派生类的拷贝构造。我觉得这类用法既不属于实现继承也不属于接口继承，只是利用了继承配合特定的语言特性达到目的。&#60;/p&#62;
&#60;p&#62;这也许已经不属于OOP理论范畴，而是与具体语言相关的一些技巧，所以我将这类用法归为实现继承、接口继承之外也另类继承。
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
