<?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[Übergabe eines const-Zeigers an eine static-Memberfunktion]]></title><description><![CDATA[<p>Hi, warum kommt bei folgendem Code der fehler</p>
<pre><code>static void setVorstand(const Mitglied *vorstand)
	{
		ptrVorstand = vorstand;
	}
</code></pre>
<p>error C2440: '=' : '<br />
const class Mitglied *' kann nicht in 'class Mitglied *' konvertiert werden<br />
Durch die Konvertierung gehen Qualifizierer verloren</p>
<p>Check ich nich...</p>
<p>Wenn ichs so schreib</p>
<pre><code>static void setVorstand(Mitglied *vorstand)
	{
		ptrVorstand = vorstand;
	}
</code></pre>
<p>funktioniert alles</p>
<p>gruß wolb</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/129428/übergabe-eines-const-zeigers-an-eine-static-memberfunktion</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 04:27:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/129428.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 13 Dec 2005 15:48:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Übergabe eines const-Zeigers an eine static-Memberfunktion on Tue, 13 Dec 2005 15:48:56 GMT]]></title><description><![CDATA[<p>Hi, warum kommt bei folgendem Code der fehler</p>
<pre><code>static void setVorstand(const Mitglied *vorstand)
	{
		ptrVorstand = vorstand;
	}
</code></pre>
<p>error C2440: '=' : '<br />
const class Mitglied *' kann nicht in 'class Mitglied *' konvertiert werden<br />
Durch die Konvertierung gehen Qualifizierer verloren</p>
<p>Check ich nich...</p>
<p>Wenn ichs so schreib</p>
<pre><code>static void setVorstand(Mitglied *vorstand)
	{
		ptrVorstand = vorstand;
	}
</code></pre>
<p>funktioniert alles</p>
<p>gruß wolb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/941185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/941185</guid><dc:creator><![CDATA[wolb0r]]></dc:creator><pubDate>Tue, 13 Dec 2005 15:48:56 GMT</pubDate></item><item><title><![CDATA[Reply to Übergabe eines const-Zeigers an eine static-Memberfunktion on Tue, 13 Dec 2005 16:24:11 GMT]]></title><description><![CDATA[<p>Bei der oberen Funktion nimmst du einen Zeiger auf ein <strong>konstantes</strong> Objekt von Mitglied und weist das so wie es aussieht an einen Zeiger auf ein <strong>nicht-konstantes</strong> Objekt zu. Das geht natürlich nicht, da man das konstante Objekt über den nicht konstanten Zeiger ändern könnte.</p>
<p>EDIT: Also entweder die untere Funktion benutzen oder ptrVorstand als const Mitglied *ptrVorstand deklarieren (Falls das so wie du es programmieren willst geht)</p>
<p>Felix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/941200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/941200</guid><dc:creator><![CDATA[Phoemuex]]></dc:creator><pubDate>Tue, 13 Dec 2005 16:24:11 GMT</pubDate></item><item><title><![CDATA[Reply to Übergabe eines const-Zeigers an eine static-Memberfunktion on Tue, 13 Dec 2005 16:38:46 GMT]]></title><description><![CDATA[<p>Ich denke es liegt daran dass du bei operator = kein const-Pointer übergibst.</p>
<p>Achja und eine statische Methode kannst du natürlich nicht auf die Attribute zugreifen.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/941214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/941214</guid><dc:creator><![CDATA[FireFlow]]></dc:creator><pubDate>Tue, 13 Dec 2005 16:38:46 GMT</pubDate></item></channel></rss>