<?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: C++ const correctness beats the .NET/Java alternatives</title>
	<atom:link href="http://graemehill.ca/c-const-correctness-beats-the-netjava-alternatives/feed" rel="self" type="application/rss+xml" />
	<link>http://graemehill.ca/c-const-correctness-beats-the-netjava-alternatives</link>
	<description></description>
	<pubDate>Sat, 19 May 2012 08:26:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ari Eisinger</title>
		<link>http://graemehill.ca/c-const-correctness-beats-the-netjava-alternatives/comment-page-1#comment-2991</link>
		<dc:creator>Ari Eisinger</dc:creator>
		<pubDate>Mon, 09 Jan 2012 04:19:19 +0000</pubDate>
		<guid isPermaLink="false">http://graemehill.ca/?p=407#comment-2991</guid>
		<description>Sorry:  I was thinking of using a read-only interface when I wrote the above, not a subclass.  The actual type of the object could be determined using RTTI, and the read-only subclass could be upcast to its writeable superclass.

With a read-only subclass, it seems to me that all you'd have to do would be to upcast and then you could use all the base class's functions including the ones that modify the object.

Anyway, it seems to require considerable gyrations to do this kind of thing, which in C++, as you say, can be done with the use of a single keyword.</description>
		<content:encoded><![CDATA[<p>Sorry:  I was thinking of using a read-only interface when I wrote the above, not a subclass.  The actual type of the object could be determined using RTTI, and the read-only subclass could be upcast to its writeable superclass.</p>
<p>With a read-only subclass, it seems to me that all you&#8217;d have to do would be to upcast and then you could use all the base class&#8217;s functions including the ones that modify the object.</p>
<p>Anyway, it seems to require considerable gyrations to do this kind of thing, which in C++, as you say, can be done with the use of a single keyword.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ari Eisinger</title>
		<link>http://graemehill.ca/c-const-correctness-beats-the-netjava-alternatives/comment-page-1#comment-2990</link>
		<dc:creator>Ari Eisinger</dc:creator>
		<pubDate>Mon, 09 Jan 2012 03:59:22 +0000</pubDate>
		<guid isPermaLink="false">http://graemehill.ca/?p=407#comment-2990</guid>
		<description>I recently realized that, due to RTTI in C#, a read-only subclass can be upcasted to its parent.  In other words, the read-only version here does not hide the writeable version it's supposed to protect.  It seems to me therefore that what is required is not just a subclass but a wrapper class with a private member that just forwards the calls to the member.  Yick!

I agree that the lack of const references and const pointers in Java and C# is a big drawback.</description>
		<content:encoded><![CDATA[<p>I recently realized that, due to RTTI in C#, a read-only subclass can be upcasted to its parent.  In other words, the read-only version here does not hide the writeable version it&#8217;s supposed to protect.  It seems to me therefore that what is required is not just a subclass but a wrapper class with a private member that just forwards the calls to the member.  Yick!</p>
<p>I agree that the lack of const references and const pointers in Java and C# is a big drawback.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

