<?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[Vererbungsproblem]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe ein komisches Vererbungsproblem und hoffe, dass ihr mir helfen könnt. Ich habe eine Klasse A, welche folgende Funktionen definiert:</p>
<pre><code>void foo(AST* ast);
virtual void foo(AST* ast, bool flag, int cnt)=0;
</code></pre>
<p>wobei das erste foo in A auch definiert wird. Nun habe ich eine Klasse B, welche von A erbt, ala:</p>
<pre><code>public B: public A{

using A::foo;
void B::foo(AST* ast, bool flag, int cnt){
...
}
}
</code></pre>
<p>Wenn ich in meiner mein schreibe:</p>
<pre><code>A *a;
B b;
a = &amp;b;
a-&gt;foo(ast, true, 0);
</code></pre>
<p>geht und läuft es wunderbar. Mache ich daraus:</p>
<pre><code>A *a;
switch(whatA}{

case typeB:
 B b;
 a = &amp;b;
 break;
case typeC:
 ...
}//End switch

a-&gt;foo(ast, true, 0);
</code></pre>
<p>bekomme ich ne Exception: pure virtual method called ...</p>
<p>Warum ????? Jemand nen Tip?</p>
<p>Danke. Uwe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/244053/vererbungsproblem</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 13:44:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/244053.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Jun 2009 14:18:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vererbungsproblem on Wed, 24 Jun 2009 14:18:38 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe ein komisches Vererbungsproblem und hoffe, dass ihr mir helfen könnt. Ich habe eine Klasse A, welche folgende Funktionen definiert:</p>
<pre><code>void foo(AST* ast);
virtual void foo(AST* ast, bool flag, int cnt)=0;
</code></pre>
<p>wobei das erste foo in A auch definiert wird. Nun habe ich eine Klasse B, welche von A erbt, ala:</p>
<pre><code>public B: public A{

using A::foo;
void B::foo(AST* ast, bool flag, int cnt){
...
}
}
</code></pre>
<p>Wenn ich in meiner mein schreibe:</p>
<pre><code>A *a;
B b;
a = &amp;b;
a-&gt;foo(ast, true, 0);
</code></pre>
<p>geht und läuft es wunderbar. Mache ich daraus:</p>
<pre><code>A *a;
switch(whatA}{

case typeB:
 B b;
 a = &amp;b;
 break;
case typeC:
 ...
}//End switch

a-&gt;foo(ast, true, 0);
</code></pre>
<p>bekomme ich ne Exception: pure virtual method called ...</p>
<p>Warum ????? Jemand nen Tip?</p>
<p>Danke. Uwe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1732172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1732172</guid><dc:creator><![CDATA[uwerothfeld]]></dc:creator><pubDate>Wed, 24 Jun 2009 14:18:38 GMT</pubDate></item><item><title><![CDATA[Reply to Vererbungsproblem on Wed, 24 Jun 2009 15:58:36 GMT]]></title><description><![CDATA[<p>uwerothfeld schrieb:</p>
<blockquote>
<p>Warum ????? Jemand nen Tip?</p>
</blockquote>
<p>Reduzier Dein Problem auf ein <em>kleines</em>, <em>komplettes</em> und <em>kompilierbares</em> Programm. Anhand der Code-Fetzen mit Syntaxfehlern kann man das schlecht sagen.</p>
<p>Gruß,<br />
SP</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1732241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1732241</guid><dc:creator><![CDATA[Sebastian Pizer]]></dc:creator><pubDate>Wed, 24 Jun 2009 15:58:36 GMT</pubDate></item><item><title><![CDATA[Reply to Vererbungsproblem on Wed, 24 Jun 2009 22:03:37 GMT]]></title><description><![CDATA[<p>uwerothfeld schrieb:</p>
<blockquote>
<p>Hallo zusammen,</p>
<p>ich habe ein komisches Vererbungsproblem und hoffe, dass ihr mir helfen könnt. Ich habe eine Klasse A, welche folgende Funktionen definiert:</p>
<pre><code>void foo(AST* ast);
virtual void foo(AST* ast, bool flag, int cnt)=0;
</code></pre>
<p>wobei das erste foo in A auch definiert wird. Nun habe ich eine Klasse B, welche von A erbt, ala:</p>
<pre><code>public B: public A{

using A::foo;
void B::foo(AST* ast, bool flag, int cnt){
...
}
}
</code></pre>
<p>Wenn ich in meiner mein schreibe:</p>
<pre><code>A *a;
B b;
a = &amp;b;
a-&gt;foo(ast, true, 0);
</code></pre>
<p>geht und läuft es wunderbar. Mache ich daraus:</p>
<pre><code>A *a;
switch(whatA}{

case typeB:
 B b;
 a = &amp;b;
 break;
case typeC:
 ...
}//End switch

a-&gt;foo(ast, true, 0);
</code></pre>
<p>bekomme ich ne Exception: pure virtual method called ...</p>
<p>Warum ????? Jemand nen Tip?</p>
<p>Danke. Uwe</p>
</blockquote>
<p>Wie's aussieht, zeigt a beim Aufruf der Methode auf ein Objekt, das es schon gar nicht mehr gibt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1732437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1732437</guid><dc:creator><![CDATA[Grautvornix]]></dc:creator><pubDate>Wed, 24 Jun 2009 22:03:37 GMT</pubDate></item><item><title><![CDATA[Reply to Vererbungsproblem on Thu, 25 Jun 2009 07:32:28 GMT]]></title><description><![CDATA[<p>upps, wie peinlich, stimmt. das passiert, wenn man copy &amp; past macht. ei ei. ich geh mich mal in die ecke stellen und schämen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> vielen dank!</p>
<p>uwe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1732504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1732504</guid><dc:creator><![CDATA[uwerothfeld_]]></dc:creator><pubDate>Thu, 25 Jun 2009 07:32:28 GMT</pubDate></item></channel></rss>