<?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[templates]]></title><description><![CDATA[<pre><code class="language-cpp">class Bubble_Sort
{
public:

template&lt;typename T&gt;
	Bubble_Sort(T array);
	~Bubble_Sort(void);

private:

	template&lt;typename T&gt;  //&lt;--- genau hier
	T  m_array;
};
</code></pre>
<p>h:\C++Projekte\Sortieralgorithmen\Bubble_Sort.h(15) : error C3856: 'Bubble_Sort': Klasse ist keine Klassenvorlage</p>
<p>was mach ich nun falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/122157/templates</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 00:34:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/122157.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Oct 2005 10:21:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to templates on Sat, 01 Oct 2005 10:21:46 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">class Bubble_Sort
{
public:

template&lt;typename T&gt;
	Bubble_Sort(T array);
	~Bubble_Sort(void);

private:

	template&lt;typename T&gt;  //&lt;--- genau hier
	T  m_array;
};
</code></pre>
<p>h:\C++Projekte\Sortieralgorithmen\Bubble_Sort.h(15) : error C3856: 'Bubble_Sort': Klasse ist keine Klassenvorlage</p>
<p>was mach ich nun falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/884024</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/884024</guid><dc:creator><![CDATA[golden_jubilee]]></dc:creator><pubDate>Sat, 01 Oct 2005 10:21:46 GMT</pubDate></item><item><title><![CDATA[Reply to templates on Sat, 01 Oct 2005 10:30:35 GMT]]></title><description><![CDATA[<p>Aus der Klasse eine Klassenvorglage machen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> Sprich mach aus der Klasse ein Klassentemplate. Wieviel Hinweise soll dir der Compiler noch geben?</p>
<pre><code class="language-cpp">template&lt;typename T&gt;
class Bubble_Sort
{
public:
    Bubble_Sort(T array);
    ~Bubble_Sort(void);

private:
    T  m_array;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/884027</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/884027</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Sat, 01 Oct 2005 10:30:35 GMT</pubDate></item><item><title><![CDATA[Reply to templates on Sat, 01 Oct 2005 10:33:52 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;class T&gt;
class Bubble_Sort 
{ 
public: 
    Bubble_Sort(T array); 
    ~Bubble_Sort(void); 

private: 
    T  m_array; 
};
</code></pre>
<p>das <em>template&lt;&gt;</em> gehört immer unmittelbar vor die klassendeklaration. außerdem muß in <em>template&lt;&gt;</em> vor dem parameter <em>class</em> und nicht <em>typename</em> stehen.</p>
<p>man kann das <em>template&lt;&gt;</em> aber auch vor eine elementfunktion der klasse setzten. sowas nennt sich dann member-template und ist noch ein bißchen komplizierter als normale templates <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>anstelle von <em>class</em> kann man vor einen template-parameter auch <em>int</em> oder einen beliebigen anderen einfachen datentyp stellen. der template-parameter ist dann kein datentyp sondern eine konstante. ZB:</p>
<pre><code class="language-cpp">template&lt;class T, int SIZE=16&gt;
class Bubble_Sort 
{ 
public: 
    Bubble_Sort(T array); 
    ~Bubble_Sort(void); 

private: 
    T  m_array[SIZE]; 
};

Bubble_Sort&lt;int&gt;    a;  // SIZE ist hier gleich 16
Bubble_Sort&lt;int,32&gt; b;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/884029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/884029</guid><dc:creator><![CDATA[Konfusius]]></dc:creator><pubDate>Sat, 01 Oct 2005 10:33:52 GMT</pubDate></item><item><title><![CDATA[Reply to templates on Sat, 01 Oct 2005 10:45:58 GMT]]></title><description><![CDATA[<p>Konfusius schrieb:</p>
<blockquote>
<p>[...] außerdem muß in <em>template&lt;&gt;</em> vor dem parameter <em>class</em> und nicht <em>typename</em> stehen. [...]</p>
</blockquote>
<p>Ne typename geht auch.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/884037</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/884037</guid><dc:creator><![CDATA[FireFlow]]></dc:creator><pubDate>Sat, 01 Oct 2005 10:45:58 GMT</pubDate></item><item><title><![CDATA[Reply to templates on Sat, 01 Oct 2005 11:38:58 GMT]]></title><description><![CDATA[<p>Yo, class oder typename ist dem Compiler schnuppe. Wie Bjarne Stroustrup sagt: &quot;Schreibfaule bevorzugen class anstatt typename.&quot; <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/884072</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/884072</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Sat, 01 Oct 2005 11:38:58 GMT</pubDate></item></channel></rss>