<?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[Basisklasse mit typeinfo feststellen]]></title><description><![CDATA[<p>Hi,</p>
<p>Ich bräuchte ein Möglichkeit festzustellen ob 2 typen miteinander ein &quot;verwandtschaftliches&quot; Verhältnis haben.</p>
<p>Ziel ist es eine SmartPointer klasse so zu schleifen dass sie auch sowas zu lässt:</p>
<pre><code>class A {...};
class B : public A [...}

...

SmartPtr&lt;B&gt; pb = new B();
SmartPtr&lt;A&gt; pa = pb;
</code></pre>
<p>Ich muss also prüfen ob der Type rechts vom &quot;=&quot; bzw im copy Constructor ein abgeleiteter Type ist und entscheiden ob die Sache legal ist oder nicht.</p>
<p>Gibt es da vorgefertigte Werkzeuge oder muss ich beim erstellen der Typeinfo selbst Hand anlegen?</p>
<p>Horrido, Wh0p.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294715/basisklasse-mit-typeinfo-feststellen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 19:02:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294715.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 31 Oct 2011 10:35:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Basisklasse mit typeinfo feststellen on Mon, 31 Oct 2011 10:35:46 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Ich bräuchte ein Möglichkeit festzustellen ob 2 typen miteinander ein &quot;verwandtschaftliches&quot; Verhältnis haben.</p>
<p>Ziel ist es eine SmartPointer klasse so zu schleifen dass sie auch sowas zu lässt:</p>
<pre><code>class A {...};
class B : public A [...}

...

SmartPtr&lt;B&gt; pb = new B();
SmartPtr&lt;A&gt; pa = pb;
</code></pre>
<p>Ich muss also prüfen ob der Type rechts vom &quot;=&quot; bzw im copy Constructor ein abgeleiteter Type ist und entscheiden ob die Sache legal ist oder nicht.</p>
<p>Gibt es da vorgefertigte Werkzeuge oder muss ich beim erstellen der Typeinfo selbst Hand anlegen?</p>
<p>Horrido, Wh0p.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138149</guid><dc:creator><![CDATA[Wh0p]]></dc:creator><pubDate>Mon, 31 Oct 2011 10:35:46 GMT</pubDate></item><item><title><![CDATA[Reply to Basisklasse mit typeinfo feststellen on Mon, 31 Oct 2011 10:51:57 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template &lt;typename T&gt;
class SmartPtr
{
  ...
public:
  ...
  template &lt;class U&gt;
  SmartPtr(const SmartPtr&lt;U&gt;&amp; p)
  ...
};
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138151</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Mon, 31 Oct 2011 10:51:57 GMT</pubDate></item><item><title><![CDATA[Reply to Basisklasse mit typeinfo feststellen on Mon, 31 Oct 2011 11:03:08 GMT]]></title><description><![CDATA[<p>Das ist mir auch klar.</p>
<p>Ich dachte eben, dass ich vielleicht sicherstellen sollte ob die operation auch wirklich legal ist.</p>
<p>Oder braucht es mich nicht zu kümmern, wenn U unt T was völlig unterschiedliches ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138153</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138153</guid><dc:creator><![CDATA[Wh0p]]></dc:creator><pubDate>Mon, 31 Oct 2011 11:03:08 GMT</pubDate></item><item><title><![CDATA[Reply to Basisklasse mit typeinfo feststellen on Mon, 31 Oct 2011 11:07:21 GMT]]></title><description><![CDATA[<p>Wh0p schrieb:</p>
<blockquote>
<p>Ich dachte eben, dass ich vielleicht sicherstellen sollte ob die operation auch wirklich legal ist.</p>
</blockquote>
<p>Darum kümmert sich doch schon der Compiler!?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138154</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Mon, 31 Oct 2011 11:07:21 GMT</pubDate></item><item><title><![CDATA[Reply to Basisklasse mit typeinfo feststellen on Mon, 31 Oct 2011 21:06:20 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/p2138139#2138139" rel="nofollow">http://www.c-plusplus.net/forum/p2138139#2138139</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2138443</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2138443</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 Oct 2011 21:06:20 GMT</pubDate></item></channel></rss>