<?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[Casten und Vererbung, richtiger Ansatz?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Problem beim casten, ich habe eine Klasse</p>
<p>Class x : public y<br />
{<br />
functions...</p>
<p>int value;<br />
}</p>
<p>nun will ich Instanzen vom Typ x in y und umgekehrt casten.</p>
<p>Leider funktioniert</p>
<p>x a;<br />
y b;<br />
a = static_cast&lt;x&gt;(b);</p>
<p>nicht. Kann mir da jemand weiterhelfen?</p>
<p>Vielen Dank für alle Antworten,</p>
<p>Moritz</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/208292/casten-und-vererbung-richtiger-ansatz</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 18:44:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208292.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Mar 2008 10:44:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Casten und Vererbung, richtiger Ansatz? on Mon, 17 Mar 2008 10:44:47 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine Problem beim casten, ich habe eine Klasse</p>
<p>Class x : public y<br />
{<br />
functions...</p>
<p>int value;<br />
}</p>
<p>nun will ich Instanzen vom Typ x in y und umgekehrt casten.</p>
<p>Leider funktioniert</p>
<p>x a;<br />
y b;<br />
a = static_cast&lt;x&gt;(b);</p>
<p>nicht. Kann mir da jemand weiterhelfen?</p>
<p>Vielen Dank für alle Antworten,</p>
<p>Moritz</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1475700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1475700</guid><dc:creator><![CDATA[Moritz06]]></dc:creator><pubDate>Mon, 17 Mar 2008 10:44:47 GMT</pubDate></item><item><title><![CDATA[Reply to Casten und Vererbung, richtiger Ansatz? on Mon, 17 Mar 2008 10:48:48 GMT]]></title><description><![CDATA[<p>Du castest hier nicht, Du kopierst. Casten ginge wie folgt:</p>
<pre><code class="language-cpp">x a;
y&amp; b = a; // geht implizit
x&amp; c = static_cast&lt;x&amp;&gt;(b); // explizit
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1475703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1475703</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 17 Mar 2008 10:48:48 GMT</pubDate></item></channel></rss>