<?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[Delegation, Objekt in Objekt]]></title><description><![CDATA[<p>Wie behebt man diesen Fehler ???</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
using namespace std;

class Date {
private :
   int _day, _month, _year;
   DateFormat *df;
public :
   Date(int day,int month,int year) {
      _day = day;
      _month = month;
      _year = year;
   }
   string toString() {
      return df-&gt;format(this);
   }
   int getDay() { return _day; }
   int getMonth() { return _month; }
   int getYear() { return _year; }     
};

class DateFormat {
public:
   virtual string format(Date *d) {
     ostringstream os;
     os &lt;&lt; d-&gt;getDay() &lt;&lt; &quot;.&quot;;
     os &lt;&lt; d-&gt;getMonth() &lt;&lt; &quot;.&quot;;
     os &lt;&lt; d-&gt;getYear();
     return os.str();
   }
};

int main() {
  Date d1(22,3,2000);
  cout &lt;&lt; d1.toString();
  getchar();  
  return 0;  
}
</code></pre>
<p>Hiernochmal bei codepad : <a href="http://codepad.org/O1J9Vt0L" rel="nofollow">http://codepad.org/O1J9Vt0L</a></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/307907/delegation-objekt-in-objekt</link><generator>RSS for Node</generator><lastBuildDate>Thu, 06 Aug 2026 15:58:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/307907.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 08 Sep 2012 16:53:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Delegation, Objekt in Objekt on Sat, 08 Sep 2012 16:53:19 GMT]]></title><description><![CDATA[<p>Wie behebt man diesen Fehler ???</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
using namespace std;

class Date {
private :
   int _day, _month, _year;
   DateFormat *df;
public :
   Date(int day,int month,int year) {
      _day = day;
      _month = month;
      _year = year;
   }
   string toString() {
      return df-&gt;format(this);
   }
   int getDay() { return _day; }
   int getMonth() { return _month; }
   int getYear() { return _year; }     
};

class DateFormat {
public:
   virtual string format(Date *d) {
     ostringstream os;
     os &lt;&lt; d-&gt;getDay() &lt;&lt; &quot;.&quot;;
     os &lt;&lt; d-&gt;getMonth() &lt;&lt; &quot;.&quot;;
     os &lt;&lt; d-&gt;getYear();
     return os.str();
   }
};

int main() {
  Date d1(22,3,2000);
  cout &lt;&lt; d1.toString();
  getchar();  
  return 0;  
}
</code></pre>
<p>Hiernochmal bei codepad : <a href="http://codepad.org/O1J9Vt0L" rel="nofollow">http://codepad.org/O1J9Vt0L</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249592</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249592</guid><dc:creator><![CDATA[HarryMason]]></dc:creator><pubDate>Sat, 08 Sep 2012 16:53:19 GMT</pubDate></item><item><title><![CDATA[Reply to Delegation, Objekt in Objekt on Sat, 08 Sep 2012 16:57:45 GMT]]></title><description><![CDATA[<p>Das ist Murx. DateFormat will Date benutzen und vice versa. Mach das Design nochmals neu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2249593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2249593</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Sat, 08 Sep 2012 16:57:45 GMT</pubDate></item></channel></rss>