<?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[Überladung in Basisklasse bereitstellen]]></title><description><![CDATA[<p>Wie kann ich eine Überladung einer Memberfunktion in einer Basis Klasse hinzufügen?</p>
<p>Also das ich bei folgenden Code als ausgabe 01 und nicht 00 erhalte:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

struct b {
    int k(double) {
        return 1;
    }
};

struct a : public b {
    int k(int) {
        return 0;
    }
};

int main() {
    a a;
    std::cout &lt;&lt; a.k(int()) &lt;&lt; a.k(double());
}
</code></pre>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/146347/überladung-in-basisklasse-bereitstellen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 15:17:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/146347.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 May 2006 22:35:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sat, 06 May 2006 22:35:44 GMT]]></title><description><![CDATA[<p>Wie kann ich eine Überladung einer Memberfunktion in einer Basis Klasse hinzufügen?</p>
<p>Also das ich bei folgenden Code als ausgabe 01 und nicht 00 erhalte:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

struct b {
    int k(double) {
        return 1;
    }
};

struct a : public b {
    int k(int) {
        return 0;
    }
};

int main() {
    a a;
    std::cout &lt;&lt; a.k(int()) &lt;&lt; a.k(double());
}
</code></pre>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052330</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Sat, 06 May 2006 22:35:44 GMT</pubDate></item><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sat, 06 May 2006 22:44:38 GMT]]></title><description><![CDATA[<p>Ich hab's durch rumprobieren gerade selber gelöst:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

struct b {
    int k(double) {
        return 1;
    }
};

struct a : public b {
    using b::k;
    int k(int) {
        return 0;
    }
};

int main() {
    a a;
    std::cout &lt;&lt; a.k(int()) &lt;&lt; a.k(double());
}
</code></pre>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052332</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052332</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Sat, 06 May 2006 22:44:38 GMT</pubDate></item><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sun, 07 May 2006 03:59:09 GMT]]></title><description><![CDATA[<p>wieder so Ding, wo ich das Verhalten des Programmes nicht nachvollziehen kann...</p>
<p>Sollte sich k(double) nicht eigentlich schon (eben durch die Vererbung) in der Stuktur befinden und k(int) nur eine Erweiterung sein?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052376</guid><dc:creator><![CDATA[MaxDemian]]></dc:creator><pubDate>Sun, 07 May 2006 03:59:09 GMT</pubDate></item><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sun, 07 May 2006 08:06:39 GMT]]></title><description><![CDATA[<p>MaxDemian schrieb:</p>
<blockquote>
<p>wieder so Ding, wo ich das Verhalten des Programmes nicht nachvollziehen kann...</p>
<p>Sollte sich k(double) nicht eigentlich schon (eben durch die Vererbung) in der Stuktur befinden und k(int) nur eine Erweiterung sein?</p>
</blockquote>
<p>Ja, das versteh ich auch nicht.</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052405</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Sun, 07 May 2006 08:06:39 GMT</pubDate></item><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sun, 07 May 2006 09:15:01 GMT]]></title><description><![CDATA[<p>ISO-Standard schrieb:</p>
<blockquote>
<p>When two or more different declarations are specified for a single name <strong>in the same scope</strong>, that name is said to be overloaded. By extension, two declarations in the same scope that declare the same name but with different types are called overloaded declarations. Only function declarations can be overloaded; object and type declarations cannot be overloaded.</p>
</blockquote>
<p>ISO-Standard schrieb:</p>
<blockquote>
<p>13.2 Declaration matching [over.dcl]<br />
A function member of a derived class is <strong>not in the same scope</strong> as a function member of the same name in a base class.</p>
</blockquote>
<p>Überladene Funktionen müssen also im selben Scope sein, bei einer abgeleiteten Klasse sind sie das aber nicht.</p>
<p>Hoffe, ich konnte helfen</p>
<p>Felix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052437</guid><dc:creator><![CDATA[Phoemuex]]></dc:creator><pubDate>Sun, 07 May 2006 09:15:01 GMT</pubDate></item><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sun, 07 May 2006 09:31:32 GMT]]></title><description><![CDATA[<p>Phoemuex schrieb:</p>
<blockquote>
<p>ISO-Standard schrieb:</p>
<blockquote>
<p>When two or more different declarations are specified for a single name <strong>in the same scope</strong>, that name is said to be overloaded. By extension, two declarations in the same scope that declare the same name but with different types are called overloaded declarations. Only function declarations can be overloaded; object and type declarations cannot be overloaded.</p>
</blockquote>
<p>ISO-Standard schrieb:</p>
<blockquote>
<p>13.2 Declaration matching [over.dcl]<br />
A function member of a derived class is <strong>not in the same scope</strong> as a function member of the same name in a base class.</p>
</blockquote>
<p>Überladene Funktionen müssen also im selben Scope sein, bei einer abgeleiteten Klasse sind sie das aber nicht.</p>
<p>Hoffe, ich konnte helfen</p>
<p>Felix</p>
</blockquote>
<p>Ja, danke. Also ist das mit dem using der richtige Weg oder?</p>
<p>Wie kann ich den gesamtem Scope der Basisklasse in den Scope der abgeleiteten packen? Geht das?</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052445</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052445</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Sun, 07 May 2006 09:31:32 GMT</pubDate></item><item><title><![CDATA[Reply to Überladung in Basisklasse bereitstellen on Sun, 07 May 2006 10:02:23 GMT]]></title><description><![CDATA[<p><a href="http://fara.cs.uni-potsdam.de/~kaufmann/?page=GenCppFaqs&amp;faq=Overload#Answ" rel="nofollow">http://fara.cs.uni-potsdam.de/~kaufmann/?page=GenCppFaqs&amp;faq=Overload#Answ</a><br />
<a href="http://fara.cs.uni-potsdam.de/~kaufmann/?page=GenCppFaqs&amp;faq=oho#Answ" rel="nofollow">http://fara.cs.uni-potsdam.de/~kaufmann/?page=GenCppFaqs&amp;faq=oho#Answ</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1052471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1052471</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Sun, 07 May 2006 10:02:23 GMT</pubDate></item></channel></rss>