<?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[Problem in eigener Klasse]]></title><description><![CDATA[<p>Hi <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code class="language-cpp">class MyList{
        public:
        MyList(int XLeft, int YTop, int Size, TForm * ThaForm, MyList * Sender );
        ~MyList();
        MyList ( MyList &amp; rhs ){}
        bool Add( int XLeft, int YTop, int Size, TForm * ThaForm );
        bool AddSimple();
        MyList* GetNext();
        MyList* GetPrevious();
        void EraseRow();

        private:

        void ErasePrevious(MyList* NextInRow);
        void EraseNext(MyList* NextInRow);
        TForm * Form;
        FallingObject * Object;
        MyList * Next;
        MyList * Previous;
};

MyList::MyList(int XLeft, int YTop, int Size, TForm * ThaForm, MyList * Sender ):
Previous(Sender),Form(ThaForm),Next(NULL){
        Object = new FallingObject(XLeft,YTop,Size,NULL,NULL,Form,NONE,&quot;&quot;,NULL);
}

bool MyList::AddSimple(){
        if ( Next ){
                Next-&gt;Add(Object-&gt;GetX(), Object-&gt;GetY(), Object-&gt;itsSize, Form);
        }else{
                Next = new MyList(Object-&gt;GetX(),Object-&gt;GetY(),Object-&gt;itsSize,Form,this);
        }
}

bool MyList::Add( int XLeft, int YTop, int Size, TForm * ThaForm ){
        if ( Next ){
                Next-&gt;Add(XLeft, YTop, Size, ThaForm);
        }else{
                Next = new MyList(XLeft,YTop,Size,ThaForm,this);
        }
}

MyList* MyList::GetNext(){
if ( Next )return Next;
}
MyList* MyList::GetPrevious(){
if ( Previous )return Previous;
}

void MyList::ErasePrevious( MyList * NextInRow ){
        if ( NextInRow-&gt;Previous )ErasePrevious(NextInRow-&gt;Previous);
        delete NextInRow-&gt;Previous;
        NextInRow-&gt;Previous = NULL;
}
void MyList::EraseNext( MyList * NextInRow ){
if ( NextInRow-&gt;Next )EraseNext(NextInRow-&gt;Next);
        delete NextInRow-&gt;Next;
        NextInRow-&gt;Next = NULL;

}

void MyList::EraseRow(){
if ( Previous ){
        ErasePrevious(Previous);
        delete Previous;
        Previous = NULL;
}
if ( Next ){
        EraseNext(Next);
        delete Next;
        Next = NULL;
}

}

MyList::~MyList(){
delete Object;
Object = NULL;
}
</code></pre>
<p>also mein problem ist das wenn ich add simple aufrufe eigentlich alles klappt wie ich es will. aber als letztes ( nachdem er den kontruktor von MyList durchgearbeitet hat ) ruft er gleich wieder den dekonstruktor auf, und ich seh den fehler ürgentwie nicht ^^'' könntet ihr mir da helfen?</p>
<p>EDIT: ... habs gesehen.. dadurch das das hier so schön klein geschrieben is .. ( hat man ne nette übersicht, ich will das forum als compiler :&lt; )</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/215743/problem-in-eigener-klasse</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 02:08:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/215743.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 Jun 2008 20:16:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:42:55 GMT]]></title><description><![CDATA[<p>Hi <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code class="language-cpp">class MyList{
        public:
        MyList(int XLeft, int YTop, int Size, TForm * ThaForm, MyList * Sender );
        ~MyList();
        MyList ( MyList &amp; rhs ){}
        bool Add( int XLeft, int YTop, int Size, TForm * ThaForm );
        bool AddSimple();
        MyList* GetNext();
        MyList* GetPrevious();
        void EraseRow();

        private:

        void ErasePrevious(MyList* NextInRow);
        void EraseNext(MyList* NextInRow);
        TForm * Form;
        FallingObject * Object;
        MyList * Next;
        MyList * Previous;
};

MyList::MyList(int XLeft, int YTop, int Size, TForm * ThaForm, MyList * Sender ):
Previous(Sender),Form(ThaForm),Next(NULL){
        Object = new FallingObject(XLeft,YTop,Size,NULL,NULL,Form,NONE,&quot;&quot;,NULL);
}

bool MyList::AddSimple(){
        if ( Next ){
                Next-&gt;Add(Object-&gt;GetX(), Object-&gt;GetY(), Object-&gt;itsSize, Form);
        }else{
                Next = new MyList(Object-&gt;GetX(),Object-&gt;GetY(),Object-&gt;itsSize,Form,this);
        }
}

bool MyList::Add( int XLeft, int YTop, int Size, TForm * ThaForm ){
        if ( Next ){
                Next-&gt;Add(XLeft, YTop, Size, ThaForm);
        }else{
                Next = new MyList(XLeft,YTop,Size,ThaForm,this);
        }
}

MyList* MyList::GetNext(){
if ( Next )return Next;
}
MyList* MyList::GetPrevious(){
if ( Previous )return Previous;
}

void MyList::ErasePrevious( MyList * NextInRow ){
        if ( NextInRow-&gt;Previous )ErasePrevious(NextInRow-&gt;Previous);
        delete NextInRow-&gt;Previous;
        NextInRow-&gt;Previous = NULL;
}
void MyList::EraseNext( MyList * NextInRow ){
if ( NextInRow-&gt;Next )EraseNext(NextInRow-&gt;Next);
        delete NextInRow-&gt;Next;
        NextInRow-&gt;Next = NULL;

}

void MyList::EraseRow(){
if ( Previous ){
        ErasePrevious(Previous);
        delete Previous;
        Previous = NULL;
}
if ( Next ){
        EraseNext(Next);
        delete Next;
        Next = NULL;
}

}

MyList::~MyList(){
delete Object;
Object = NULL;
}
</code></pre>
<p>also mein problem ist das wenn ich add simple aufrufe eigentlich alles klappt wie ich es will. aber als letztes ( nachdem er den kontruktor von MyList durchgearbeitet hat ) ruft er gleich wieder den dekonstruktor auf, und ich seh den fehler ürgentwie nicht ^^'' könntet ihr mir da helfen?</p>
<p>EDIT: ... habs gesehen.. dadurch das das hier so schön klein geschrieben is .. ( hat man ne nette übersicht, ich will das forum als compiler :&lt; )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529231</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:42:55 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:20:28 GMT]]></title><description><![CDATA[<p>Ich sehe hier nirgends, dass der Konstruktor aufgerufen wird. Also wird es schwer den Fehler zu finden. Ich würde mal darauf tippen, dass das Programm einfach gleich wieder zu Ende ist..</p>
<p>btw:<br />
Das mit dem deleten klappt so nicht, gibt Memoryleaks.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529236</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529236</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:20:28 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:22:43 GMT]]></title><description><![CDATA[<p>warum nicht? wenn ich bei jedem in der liste den dekonstruktor aufrufe und vll. nen paar versuchen nen null pointer zu löschen ... wo sind da die leaks ^^?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529237</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529237</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:22:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:22:30 GMT]]></title><description><![CDATA[<p>Dat Ding heißt übrigens Destruktor und</p>
<pre><code class="language-cpp">delete Object, Next, Previous;
</code></pre>
<p>wird wahrscheinlich nicht das tun, was du beabsichtigst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529238</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529238</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:23:09 GMT]]></title><description><![CDATA[<p>und was wird es tun?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529240</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:25:26 GMT]]></title><description><![CDATA[<p>Schurke schrieb:</p>
<blockquote>
<p>und was wird es tun?</p>
</blockquote>
<p>Das Objekt, auf dass Previous zeigt, versuchen zu löschen und sonst nichts. Sieht nicht so aus, als ob Previous überhaupt initialisiert wird...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529241</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:25:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:28:09 GMT]]></title><description><![CDATA[<p>wird es schon ( hatte das vorhin auch gesehen das es mit dem kon. ohne sender nicht klappt ^^ )</p>
<pre><code class="language-cpp">MyList::MyList(int XLeft, int YTop, int Size, TForm * ThaForm, MyList * Sender ):
Previous(Sender),Form(ThaForm),Next(NULL){//&lt;---
        Object = new FallingObject(XLeft,YTop,Size,NULL,NULL,Form,NONE,&quot;&quot;,NULL);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1529243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529243</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:28:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in eigener Klasse on Sat, 14 Jun 2008 20:51:03 GMT]]></title><description><![CDATA[<p>camper wollte darauf hindeuten, dass</p>
<pre><code class="language-cpp">delete Object, Next, Previous;
</code></pre>
<p>äquivalent zu</p>
<pre><code class="language-cpp">Object; Next; delete Previous
</code></pre>
<p>ist.</p>
<p>Es wird also nur Previus gelöscht.</p>
<p>Gruß<br />
Don06</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1529256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1529256</guid><dc:creator><![CDATA[Don06]]></dc:creator><pubDate>Sat, 14 Jun 2008 20:51:03 GMT</pubDate></item></channel></rss>