<div dir="ltr">Great idea!<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 18, 2013 at 3:55 PM, Zaher Dirkey <span dir="ltr"><<a href="mailto:parmaja@gmail.com" target="_blank">parmaja@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">I think it is not the first time this topic was opened, but still think we need when using object to have automatically destructor called by compiler when the object freed<br>
<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">TmyObject = object<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"> FSQL: TStringList;<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">
constructor Init(SQL: string);<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"> destructor Free;<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">end;<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">
<br>constructor TmyObject.Init(SQL: string);<br>begin<br> FSQL:=TStringList.Create;<br>end;<br><br>destructor TmyObject.Free;<br>begin<br> FSQL.Free;<br>end;<br><br>Here in the example we can call init manually and it is not a problem, because it is always we know who is create this object.<br>
</div><div class="gmail_default" style="font-family:tahoma,sans-serif">But free or destroy can not call it manually, we not know who will kill that object first, because many of another object assigned to it.<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">
<br>Ref<br><a href="http://lists.freepascal.org/lists/fpc-pascal/2006-August/011626.html" target="_blank">http://lists.freepascal.org/lists/fpc-pascal/2006-August/011626.html</a><br><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">
I know about Interfaces but i hate use it, <br>All just we need new feature to call "destroy" when freeing the object.<br></div><br><div dir="ltr"><span style="font-family:courier new,monospace">Best Regards<span class="HOEnZb"><font color="#888888"><br>
Zaher Dirkey</font></span></span></div>
</div>
<br>_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br></blockquote></div><br></div>