<?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[Objektklasse prüfen]]></title><description><![CDATA[<p>Hallo,</p>
<p>aus C# kenne ich das Schlüsselwort &quot;is&quot;, womit ich prüfen kann, ob ein Objekt eine Instanz einer bestimmten Klasse ist:</p>
<pre><code class="language-cpp">if (inst is Class1)
</code></pre>
<p>Wie setze ich sowas in C++ um?</p>
<p>lg Neulinger</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/281983/objektklasse-prüfen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 09:37:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/281983.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 11 Feb 2011 14:17:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Objektklasse prüfen on Fri, 11 Feb 2011 14:17:00 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>aus C# kenne ich das Schlüsselwort &quot;is&quot;, womit ich prüfen kann, ob ein Objekt eine Instanz einer bestimmten Klasse ist:</p>
<pre><code class="language-cpp">if (inst is Class1)
</code></pre>
<p>Wie setze ich sowas in C++ um?</p>
<p>lg Neulinger</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2019678</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2019678</guid><dc:creator><![CDATA[Neulinger]]></dc:creator><pubDate>Fri, 11 Feb 2011 14:17:00 GMT</pubDate></item><item><title><![CDATA[Reply to Objektklasse prüfen on Fri, 11 Feb 2011 14:19:48 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>da kannst du nach typeid suchen, gibt's auch viele Threads hier im Forum. Allerdings solltest Du Dir überlegen, warum Du überhaupt die Klasse bestimmen möchtest... Meistens lässt sich das eleganter lösen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2019681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2019681</guid><dc:creator><![CDATA[Eisflamme]]></dc:creator><pubDate>Fri, 11 Feb 2011 14:19:48 GMT</pubDate></item><item><title><![CDATA[Reply to Objektklasse prüfen on Fri, 11 Feb 2011 14:37:01 GMT]]></title><description><![CDATA[<p>Ja auf typeid bin ich auch schon oft gestoßen, bekomme es aber an der Stelle nicht zum laufen...</p>
<p>Verallgemeinert:</p>
<pre><code class="language-cpp">class A {};
class B : public A {};
class C : public B {};
class D : public B {};

int main(A* inst)
{
   // hier soll überprüft werden, ob A eine Instanz von C, D oder weder noch ist
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2019688</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2019688</guid><dc:creator><![CDATA[Neulinger]]></dc:creator><pubDate>Fri, 11 Feb 2011 14:37:01 GMT</pubDate></item><item><title><![CDATA[Reply to Objektklasse prüfen on Fri, 11 Feb 2011 14:38:20 GMT]]></title><description><![CDATA[<p>Neulinger schrieb:</p>
<blockquote>
<p>Ja auf typeid bin ich auch schon oft gestoßen, bekomme es aber an der Stelle nicht zum laufen...</p>
<p>Verallgemeinert:</p>
<pre><code class="language-cpp">class A {};
class B : public A {};
class C : public B {};
class D : public B {};

int main(A* inst)
{
   // hier soll überprüft werden, ob inst eine Instanz von C, D oder weder noch ist
}
</code></pre>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2019690</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2019690</guid><dc:creator><![CDATA[Neulinger]]></dc:creator><pubDate>Fri, 11 Feb 2011 14:38:20 GMT</pubDate></item><item><title><![CDATA[Reply to Objektklasse prüfen on Fri, 11 Feb 2011 14:43:30 GMT]]></title><description><![CDATA[<p>Ist dynamic_cast vielleicht was für dich?</p>
<p>Wobei dies in 99% der Fälle ein Designfehler ist, wenn Anfänger solche Fragen stellen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2019694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2019694</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 11 Feb 2011 14:43:30 GMT</pubDate></item><item><title><![CDATA[Reply to Objektklasse prüfen on Fri, 11 Feb 2011 15:49:42 GMT]]></title><description><![CDATA[<p>Neulinger, hast du <a href="http://www.c-plusplus.net/forum/281473" rel="nofollow">deinen alten Thread</a> schon wieder vergessen? Ich werde hier nicht wiederholen, was ich dort schon zur Begründung gesagt habe, warum explizite Typunterscheidungen schlecht sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2019744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2019744</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Fri, 11 Feb 2011 15:49:42 GMT</pubDate></item><item><title><![CDATA[Reply to Objektklasse prüfen on Mon, 14 Feb 2011 08:04:52 GMT]]></title><description><![CDATA[<p>Bitte das Thema im alten Thread weiterführen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2020690</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2020690</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Mon, 14 Feb 2011 08:04:52 GMT</pubDate></item></channel></rss>