<?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[no matching function call to]]></title><description><![CDATA[<p>hallo,<br />
ich stehe gerade vor einem problem dass ich nicht lösen kann<br />
mein compiler gibt:</p>
<pre><code>D:\classes\bird\main.cpp|19|error: no matching function for call to `Karten::Karten()'|
</code></pre>
<p>aus mein quellcode für die beiden klassen:</p>
<pre><code class="language-cpp">class Karten{

    public:
        Karten(char *Name,double price){p_caname=Name;p_price=price;}
        char*KartenNameAusgeben(){
            return p_caname;
        }
    private:
        char*p_caname;
        double p_price;
};

class Veranstaltung{

    public:
        Veranstaltung(char*Name,char*Kuenstler,tm*date,int AnzKarten,double price[],char*caname[]) {
            for(int i=0;i&lt;AnzKarten;i++){
                KartenArray[i]=Karten(&quot;Hallo&quot;,2.00);

            }
            p_name=Name;
            p_kuenstler=Kuenstler;
            p_AnzKarten=AnzKarten;
            p_tm=date;
        }

        char*DatumAusgeben(){
            char*text;
            sprintf(text,&quot;%d.%d.%d&quot;,p_tm-&gt;tm_mday,p_tm-&gt;tm_mon+1,p_tm-&gt;tm_year+1900);
            return text;
        }
        char*NameAusgeben(){
            char*text;
            sprintf(text,&quot;%s&quot;,p_name);
            return text;
        }
        char*KuenstlerAusgeben(){
            char*text;
            sprintf(text,&quot;%s&quot;,p_kuenstler);
            return text;
        }
        char**KartenNameAusgeben(){
            char**text;
            for(int i=0;i&lt;p_AnzKarten;i++){
            text[i]= KartenArray[i].KartenNameAusgeben();
            }
            return text;
        }

    private:
        char*p_name;
        char*p_kuenstler;
        tm*p_tm;
        Karten KartenArray[20];
        int p_AnzKarten;
};
</code></pre>
<p>Schonmal danke für eure Hilfe:)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/258439/no-matching-function-call-to</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 09:53:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/258439.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 10 Jan 2010 15:46:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 15:46:37 GMT]]></title><description><![CDATA[<p>hallo,<br />
ich stehe gerade vor einem problem dass ich nicht lösen kann<br />
mein compiler gibt:</p>
<pre><code>D:\classes\bird\main.cpp|19|error: no matching function for call to `Karten::Karten()'|
</code></pre>
<p>aus mein quellcode für die beiden klassen:</p>
<pre><code class="language-cpp">class Karten{

    public:
        Karten(char *Name,double price){p_caname=Name;p_price=price;}
        char*KartenNameAusgeben(){
            return p_caname;
        }
    private:
        char*p_caname;
        double p_price;
};

class Veranstaltung{

    public:
        Veranstaltung(char*Name,char*Kuenstler,tm*date,int AnzKarten,double price[],char*caname[]) {
            for(int i=0;i&lt;AnzKarten;i++){
                KartenArray[i]=Karten(&quot;Hallo&quot;,2.00);

            }
            p_name=Name;
            p_kuenstler=Kuenstler;
            p_AnzKarten=AnzKarten;
            p_tm=date;
        }

        char*DatumAusgeben(){
            char*text;
            sprintf(text,&quot;%d.%d.%d&quot;,p_tm-&gt;tm_mday,p_tm-&gt;tm_mon+1,p_tm-&gt;tm_year+1900);
            return text;
        }
        char*NameAusgeben(){
            char*text;
            sprintf(text,&quot;%s&quot;,p_name);
            return text;
        }
        char*KuenstlerAusgeben(){
            char*text;
            sprintf(text,&quot;%s&quot;,p_kuenstler);
            return text;
        }
        char**KartenNameAusgeben(){
            char**text;
            for(int i=0;i&lt;p_AnzKarten;i++){
            text[i]= KartenArray[i].KartenNameAusgeben();
            }
            return text;
        }

    private:
        char*p_name;
        char*p_kuenstler;
        tm*p_tm;
        Karten KartenArray[20];
        int p_AnzKarten;
};
</code></pre>
<p>Schonmal danke für eure Hilfe:)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836361</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 15:46:37 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 15:54:27 GMT]]></title><description><![CDATA[<p>Du rufst den def-ctor auf, obwohl du keinen definiert hast. Zeig mal Zeile 19.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836370</guid><dc:creator><![CDATA[Kóyaánasqatsi]]></dc:creator><pubDate>Sun, 10 Jan 2010 15:54:27 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 15:56:19 GMT]]></title><description><![CDATA[<p>zeile 19 ist hier zeile 16 (weil ich die includes weggelassen habe)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836372</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 15:56:19 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 15:58:18 GMT]]></title><description><![CDATA[<p>Kann eigentlich nicht sein. Was ist denn &quot;tm&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836374</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836374</guid><dc:creator><![CDATA[Kóyaánasqatsi]]></dc:creator><pubDate>Sun, 10 Jan 2010 15:58:18 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 15:59:23 GMT]]></title><description><![CDATA[<p>tm ist dass:<br />
<a href="http://www.cplusplus.com/reference/clibrary/ctime/tm/" rel="nofollow">http://www.cplusplus.com/reference/clibrary/ctime/tm/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836375</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 15:59:23 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:00:28 GMT]]></title><description><![CDATA[<p>Der Konstruktor von Veranstaltung ruft 20 Standard Konstrukoren von Karten auf. Im Funktionsrumpf erfolgt dann eine Zuweisung.<br />
Karten braucht also noch einen Standardkonstruktor</p>
<pre><code class="language-cpp">Karten()
:p_caname(0),p_price(0)
{}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1836377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836377</guid><dc:creator><![CDATA[brotbernd]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:00:28 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:06:59 GMT]]></title><description><![CDATA[<p>so nun ist mein weiteres problem dass wenn ich z.B.</p>
<pre><code class="language-cpp">char*DatumAusgeben()
</code></pre>
<p>aufrufe und danach eine andere Funktion aufrufen will stürtzt es ab</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836382</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:06:59 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:09:54 GMT]]></title><description><![CDATA[<p>brotbernd schrieb:</p>
<blockquote>
<p>Karten braucht also noch einen Standardkonstruktor</p>
</blockquote>
<p>Oder du bastelst dir keine hässlichen Workarounds wie Dummy-Standardkonstruktoren und benutzt elegantere Wege. Einer davon wäre für mich <code>std::vector</code> statt eines Arrays, den du sukzessive mit den Karten füllst. Dann musst du dir nämlich auch nicht in einer separaten Variable die Anzahl merken. Eine Einführung in die STL findest du <a href="http://magazin.c-plusplus.net/artikel/Aufbau%20der%20STL%20-%20Teil%201%3A%20Container" rel="nofollow">hier</a>.</p>
<p>Dann könnte die For-Schleife so aussehen:</p>
<pre><code class="language-cpp">for(int i=0; i &lt; AnzKarten; ++i)
{
    KartenArray.push_back(Karten(&quot;Hallo&quot;,2.00));
}
</code></pre>
<p>wobei die Deklaration des Containers so aussieht:</p>
<pre><code class="language-cpp">std::vector&lt;Karten&gt; KartenArray;
</code></pre>
<p>Ausserdem würde ich anstelle von <code>char*</code> , <code>sprintf()</code> und solchen C-Dingen moderne C++-Mittel wie <code>std::string</code> und <code>std::stringstream</code> einsetzen. Dann hast du mehr Sicherheit, sowohl zur Compile- als auch zur Laufzeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836388</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:09:54 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:11:29 GMT]]></title><description><![CDATA[<p>ist dass die Lösung für mein 2. Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836389</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:11:29 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:16:14 GMT]]></title><description><![CDATA[<p>Ja, du zerschreibst dir nämlich mit <code>sprintf()</code> den Speicher, da du auf einen uninitialisierten Zeiger zugreifst. Klar, man könnte dafür Speicher anfordern, aber man müsste wieder genau darauf achten, dass genügend vorhanden wäre, damit eventuelle Änderungen an der Klasse nicht plötzlich merkwürdiges Programmverhalten hervorrufen. Ausserdem musst du darauf achten, dass der angeforderte Speicher wieder freigegeben wird. Man muss dem Aufrufer der Funktion kommunizieren, dass er verantwortlich dafür ist, und trotzdem kann es sehr leicht vergessen werden.</p>
<p>Das sind alles Probleme, welche dir mit <code>std::string</code> nicht passieren können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836397</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836397</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:16:14 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:19:49 GMT]]></title><description><![CDATA[<p>danke also hab ich einfach nur malloc vergessen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836402</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836402</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:19:49 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:23:05 GMT]]></title><description><![CDATA[<p>klg71 schrieb:</p>
<blockquote>
<p>danke also hab ich einfach nur malloc vergessen?</p>
</blockquote>
<p>Ja. In C++ aber eher <code>new</code> .</p>
<p>Aber ich habe dich auf etliche andere Probleme hingewiesen. Wenn dir etwas an modernem C++ und sauberem Design gelegen ist, solltest du die Hinweise vielleicht beherzigen. Wenn du gerne debuggst und dich mit Low-Level-Fehlern rumschlägst, solltest du sie ignorieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836407</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836407</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:23:05 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:45:16 GMT]]></title><description><![CDATA[<p>gut ixh werde mir sie annehmen aber es wird bestimmt eine weile dauern bisschen ich den C-Stil wieder weg hab:) <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/1836421</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836421</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:45:16 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:52:49 GMT]]></title><description><![CDATA[<p>Hm, hast du ein gutes C++-Buch wie den C++-Primer? Dort sollten solche Dinge eigentlich von Anfang an erklärt werden. Auch die STL (Standard Template Library) ist ein sehr wichtiger Bestandteil der C++-Standardbibliothek. In meinem ersten Post habe ich dir dazu einen Link gegeben, der die wichtigsten Dinge erläutert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836429</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836429</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:52:49 GMT</pubDate></item><item><title><![CDATA[Reply to no matching function call to on Sun, 10 Jan 2010 16:54:24 GMT]]></title><description><![CDATA[<p>ja ich hab den link gesehen nein ich habe leider kein buch:D<br />
alles aus dem inet</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836432</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836432</guid><dc:creator><![CDATA[klg71]]></dc:creator><pubDate>Sun, 10 Jan 2010 16:54:24 GMT</pubDate></item></channel></rss>