<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Klassentemplates und private]]></title><description><![CDATA[<pre><code>class A {
private:
   template&lt;typename T&gt; struct Internal {};
};

template&lt;typename T&gt; class B {
public:
   typedef A::Internal&lt;T&gt; Internal;
};

void f()
{
    A::Internal&lt;int&gt; x;   // Fehler
    B&lt;int&gt;::Internal y;   // Ok --- warum?
}
</code></pre>
<p>Meine Frage: warum akzeptiert der Compiler die Definition von y? Letzlich tut sie doch das gleiche wie die vorangehende Zeile, d.h. x und y hätten den gleichen Typ, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/263579/klassentemplates-und-private</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 18:24:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/263579.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 Mar 2010 21:26:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Klassentemplates und private on Mon, 22 Mar 2010 21:26:29 GMT]]></title><description><![CDATA[<pre><code>class A {
private:
   template&lt;typename T&gt; struct Internal {};
};

template&lt;typename T&gt; class B {
public:
   typedef A::Internal&lt;T&gt; Internal;
};

void f()
{
    A::Internal&lt;int&gt; x;   // Fehler
    B&lt;int&gt;::Internal y;   // Ok --- warum?
}
</code></pre>
<p>Meine Frage: warum akzeptiert der Compiler die Definition von y? Letzlich tut sie doch das gleiche wie die vorangehende Zeile, d.h. x und y hätten den gleichen Typ, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1872732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872732</guid><dc:creator><![CDATA[argoat]]></dc:creator><pubDate>Mon, 22 Mar 2010 21:26:29 GMT</pubDate></item><item><title><![CDATA[Reply to Klassentemplates und private on Mon, 22 Mar 2010 21:39:27 GMT]]></title><description><![CDATA[<p>Was hast du für einen Compiler? - Bei mir (MSVC++) kompiliert das korrekterweise nicht.</p>
<pre><code class="language-cpp">void f()
{
    //A::Internal&lt;int&gt; x;   // Fehler
    B&lt;int&gt;::Internal y;   // Ok --- warum?
</code></pre>
<blockquote>
<p>error C2248: 'A::Internal&lt;T&gt;' : cannot access private struct declared in class 'A'</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1872735</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872735</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Mon, 22 Mar 2010 21:39:27 GMT</pubDate></item><item><title><![CDATA[Reply to Klassentemplates und private on Mon, 22 Mar 2010 22:03:20 GMT]]></title><description><![CDATA[<p>drakon schrieb:</p>
<blockquote>
<p>Was hast du für einen Compiler? - Bei mir (MSVC++) kompiliert das korrekterweise nicht.<br />
...</p>
</blockquote>
<p>Ich verwende GCC (4.4 und 4.3)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1872741</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1872741</guid><dc:creator><![CDATA[argoat]]></dc:creator><pubDate>Mon, 22 Mar 2010 22:03:20 GMT</pubDate></item></channel></rss>