<?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[switch mit Objekterzeugung]]></title><description><![CDATA[<p>Ich habe in meiner main eine switch die mir je nach Anwendungsfall verschiedene Objekte erzeugt. Dabei ist mir nun etwas komisches aufgefallen:</p>
<pre><code>int ANWENDUNGSFALL = BEISPIEL;

  switch(ANWENDUNGSFALL)
  {

    case BEISPIEL:
    {
      DatenModul* D = new DatenModul(3);
      BeispielModul1* B1 = new BeispielModul1(D, &quot;BeispielModul1&quot;);
      BeispielModul2* B2 = new BeispielModul2(D, &quot;BeispielModul2&quot;);
    }

    case RUNDKURS:
    {

      DatenModul* D = new DatenModul(1);

    }

    case HINDERNIS:
    {

      DatenModul* D = new DatenModul(1);

    }

    case EINPARKEN:
    {

      DatenModul* D = new DatenModul(1);

    }
  }
</code></pre>
<p>Eigentlich sollte das DatenModul nur einmal erstellt werden. Im Konstruktor des DatenModuls wird eine Logdatei auf dem Dateisystem erstellt und geöffnet. Das für mich verwunderliche ist nun, dass immer 4 Logdateien erstellt werden! Als würden alle 4 case Fälle eintreten, aber warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/258405/switch-mit-objekterzeugung</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 10:35:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/258405.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 10 Jan 2010 10:21:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to switch mit Objekterzeugung on Sun, 10 Jan 2010 10:21:56 GMT]]></title><description><![CDATA[<p>Ich habe in meiner main eine switch die mir je nach Anwendungsfall verschiedene Objekte erzeugt. Dabei ist mir nun etwas komisches aufgefallen:</p>
<pre><code>int ANWENDUNGSFALL = BEISPIEL;

  switch(ANWENDUNGSFALL)
  {

    case BEISPIEL:
    {
      DatenModul* D = new DatenModul(3);
      BeispielModul1* B1 = new BeispielModul1(D, &quot;BeispielModul1&quot;);
      BeispielModul2* B2 = new BeispielModul2(D, &quot;BeispielModul2&quot;);
    }

    case RUNDKURS:
    {

      DatenModul* D = new DatenModul(1);

    }

    case HINDERNIS:
    {

      DatenModul* D = new DatenModul(1);

    }

    case EINPARKEN:
    {

      DatenModul* D = new DatenModul(1);

    }
  }
</code></pre>
<p>Eigentlich sollte das DatenModul nur einmal erstellt werden. Im Konstruktor des DatenModuls wird eine Logdatei auf dem Dateisystem erstellt und geöffnet. Das für mich verwunderliche ist nun, dass immer 4 Logdateien erstellt werden! Als würden alle 4 case Fälle eintreten, aber warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836107</guid><dc:creator><![CDATA[fabske]]></dc:creator><pubDate>Sun, 10 Jan 2010 10:21:56 GMT</pubDate></item><item><title><![CDATA[Reply to switch mit Objekterzeugung on Sun, 10 Jan 2010 10:22:59 GMT]]></title><description><![CDATA[<p>du hast das <code>break;</code> vergessen...</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836108</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Sun, 10 Jan 2010 10:22:59 GMT</pubDate></item><item><title><![CDATA[Reply to switch mit Objekterzeugung on Sun, 10 Jan 2010 10:23:34 GMT]]></title><description><![CDATA[<p>Schau noch einmal in dein Grundlagenbuch und achte auf das Wörtchen break;-)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836109</guid><dc:creator><![CDATA[brotbernd]]></dc:creator><pubDate>Sun, 10 Jan 2010 10:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to switch mit Objekterzeugung on Sun, 10 Jan 2010 10:31:13 GMT]]></title><description><![CDATA[<p>Ach man! Danke :=)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836115</guid><dc:creator><![CDATA[fabske]]></dc:creator><pubDate>Sun, 10 Jan 2010 10:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to switch mit Objekterzeugung on Sun, 10 Jan 2010 14:33:29 GMT]]></title><description><![CDATA[<p>Wenn dein <code>switch</code> grösser und unübersichtlicher wird, kann es sich lohnen, sich nach einer Alternative umzusehen. Dazu gibts im Forum hier einen Artikel, den du bei Interesse anschauen könntest: <a href="http://magazin.c-plusplus.net/artikel/Object-Switching" rel="nofollow">Object-Switching</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1836298</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1836298</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 10 Jan 2010 14:33:29 GMT</pubDate></item></channel></rss>