<?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[Problem mit Vererbung]]></title><description><![CDATA[<p>hi,<br />
folgendes Problem:<br />
ich habe eine klasse <em>foo</em> und eine klasse <em>bar</em> die von <em>foo</em> erbt.<br />
jetzt hat <em>bar</em> methoden die <em>foo</em> nicht hat. hab ich irgendwie die möglichkeit<br />
diese funktionen nutzen zu können wenn mein objekt so</p>
<pre><code>foo *foobar = new bar();
</code></pre>
<p>erstellt wurde?<br />
also praktisch</p>
<pre><code>foobar-&gt;methode_die_nur_bar_nicht_aber_foo_hat()
</code></pre>
<p>ich meine darüber mal was in einem vortrag gesehen zu haben kann mich aber nicht mehr richtig erinnern...</p>
<p>mfg und schonmal danke,<br />
cypher</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/148049/problem-mit-vererbung</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 12:59:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148049.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 22 May 2006 20:06:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Vererbung on Mon, 22 May 2006 20:06:39 GMT]]></title><description><![CDATA[<p>hi,<br />
folgendes Problem:<br />
ich habe eine klasse <em>foo</em> und eine klasse <em>bar</em> die von <em>foo</em> erbt.<br />
jetzt hat <em>bar</em> methoden die <em>foo</em> nicht hat. hab ich irgendwie die möglichkeit<br />
diese funktionen nutzen zu können wenn mein objekt so</p>
<pre><code>foo *foobar = new bar();
</code></pre>
<p>erstellt wurde?<br />
also praktisch</p>
<pre><code>foobar-&gt;methode_die_nur_bar_nicht_aber_foo_hat()
</code></pre>
<p>ich meine darüber mal was in einem vortrag gesehen zu haben kann mich aber nicht mehr richtig erinnern...</p>
<p>mfg und schonmal danke,<br />
cypher</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063092</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063092</guid><dc:creator><![CDATA[Cypher]]></dc:creator><pubDate>Mon, 22 May 2006 20:06:39 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Vererbung on Mon, 22 May 2006 20:10:23 GMT]]></title><description><![CDATA[<p>Das widerspricht dem Sinn von Vererbung. Du hast an dieser Stelle ein Foo. Wenn Du sicherstellen willst, daß an dieser Stelle auf jeden Fall ein Bar steht, dann schreib halt Bar* statt Foo*. Mit einem cast kannst Du den Compiler natürlich dazu zwingen. Aber das geht schief, wenn Du wirklich mal nur ein Foo hast.</p>
<p>MfG Jester</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063099</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063099</guid><dc:creator><![CDATA[Jester]]></dc:creator><pubDate>Mon, 22 May 2006 20:10:23 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Vererbung on Mon, 22 May 2006 21:15:21 GMT]]></title><description><![CDATA[<p>Mit dynamic_cast downcasten. Wirft ne bad_cast exception falls des wirklich kein bar ist (sondern nur foo). Aber eigentlich widerspricht des echt dem Konzept von Vererbung...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063135</guid><dc:creator><![CDATA[bluecode]]></dc:creator><pubDate>Mon, 22 May 2006 21:15:21 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Vererbung on Mon, 22 May 2006 21:55:33 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>falsch, <a href="http://www.cppreference.com/keywords/dynamic_cast.html" rel="nofollow">dynamic_cast</a> gibt bei nichtkompatiblen Typen 0 zurück. Es wird keine Exception geworfen.</p>
<p>/Edit das es trotzdem das schlechtere Mittel ist, stimmt natürlich.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063145</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 22 May 2006 21:55:33 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Vererbung on Mon, 22 May 2006 22:12:19 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a>: Jo aber nur wenn du zu nem Pointer casten willst. Willst du zu ner Referenz casten, dann gibts ne exception. :p<br />
Wir hatten also beide unrecht.</p>
<p><a href="http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/topic/com.ibm.vacpp6m.doc/language/ref/clrc05keyword_dynamic_cast.htm" rel="nofollow">dynamic_cast</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063151</guid><dc:creator><![CDATA[bluecode]]></dc:creator><pubDate>Mon, 22 May 2006 22:12:19 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Vererbung on Tue, 23 May 2006 14:21:24 GMT]]></title><description><![CDATA[<p>ich dank euch.<br />
ich hab die sache jetzt soweit angepasst, dass es nicht mehr nötig ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1063576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1063576</guid><dc:creator><![CDATA[Cypher]]></dc:creator><pubDate>Tue, 23 May 2006 14:21:24 GMT</pubDate></item></channel></rss>