<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Class Delete]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15333&amp;type=atom" />
	<updated>2020-05-02T13:00:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15333</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139280#p139280" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Сохранил результаты ObjBindMethod в обычный массив.</p></blockquote></div><p>С этим тоже возникли неудобства и глюки.<br />Так вроде всё норм.<br />Непонятно конечно почему ObjBindMethod так работает, и им нельзя нормально воспользоваться.<br /></p><div class="codebox"><pre><code>
ex := new class1() 
ex.func.Call() 
Return

class class1 { 
	__New() {   
		Class := this.__Class
		this.func := ObjBindMethod(%Class%, &quot;method&quot;, &amp;this)  
		this.param := 123
	} 
	method(hThis) {
		this := Object(hThis) 
		MsgBox % A_ThisFunc  &quot;`n&quot; this.param
	} 
	__Delete() {
		MsgBox % A_ThisFunc 
	} 
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-02T13:00:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139280#p139280</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139271#p139271" />
			<content type="html"><![CDATA[<p>Думаю как правильнее должно быть. <br />Родительский класс нужен, чтобы его имя можно было изменить только в одном месте.<br />Инкапсуляция, просто чтобы всё было в рамках одного объекта, ну и чтобы имена классов не пересеклись с другими классами или переменными.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-01T16:41:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139271#p139271</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139269#p139269" />
			<content type="html"><![CDATA[<p>Нет, вложенный класс ничего не знает о родительском. А зачем такой перекрёстный огонь нужен? Класс придуман, чтобы инкапсулировать какой-то функционал.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-05-01T15:17:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139269#p139269</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139264#p139264" />
			<content type="html"><![CDATA[<p>А возможно вызывать class1.method из вложенного класса не указывая имя class1?<br />Нет какой то ссылки на родительский класс?<br /></p><div class="codebox"><pre><code>
ex := new class1() 
ex.func.Call()
Return

class class1
{ 
   __New()
   {  
      this.NC := new this.NestedClass
      this.func := ObjBindMethod(this.NC, &quot;method&quot;)  
   }  
   method()
   {
      MsgBox % A_ThisFunc 
   } 
   class NestedClass {
      method()
      { 
         class1.method()
      }  
   }
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-01T14:13:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139264#p139264</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139262#p139262" />
			<content type="html"><![CDATA[<p>Начал править уже созданный класс, придётся переписывать прежние вызовы. </p><p>Сохранил результаты ObjBindMethod в обычный массив.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-01T09:09:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139262#p139262</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139258#p139258" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>нужен метод class1</p></blockquote></div><p>А какая разница? Если нужно использовать при вызове метода какие-то поля из class1, можно просто передать их во встроенный класс при создании его инстанса.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-30T21:57:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139258#p139258</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139257#p139257" />
			<content type="html"><![CDATA[<p>Это понятно, но нужен метод class1. Пока сохраняю в обычном массиве.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-30T21:52:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139257#p139257</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139256#p139256" />
			<content type="html"><![CDATA[<p>Обойти можно так:<br /></p><div class="codebox"><pre><code>ex := new class1() 
ex.func.Call()
Return

class class1
{ 
   __New()
   {  
      this.NC := new this.NestedClass
      this.func := ObjBindMethod(this.NC, &quot;method&quot;)  
   } 
   __Delete()
   {
      MsgBox % A_ThisFunc 
   }
   class NestedClass {
      method()
      {
         MsgBox % A_ThisFunc 
      }  
   }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-30T19:46:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139256#p139256</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139255#p139255" />
			<content type="html"><![CDATA[<p>Опять я в справке недочитал...</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-30T18:45:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139255#p139255</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139253#p139253" />
			<content type="html"><![CDATA[<p>Кода используется связка ObjBindMethod(this, ...), возникает циркулярная ссылка на this, поэтому при освобождении ex не все ссылки на него удаляются.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-30T18:15:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139253#p139253</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Class Delete]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139251#p139251" />
			<content type="html"><![CDATA[<p>Не понимаю почему __Delete не вызывается.<br />Если строку с ObjBindMethod(this, &quot;method&quot;) удалить или заменить на Func(&quot;method&quot;), то всё работает.<br /></p><div class="codebox"><pre><code>
ex := new class1() 
ex.func.Call()
Return

class class1
{ 
	__New()
	{  
		; this.func := Func(&quot;method&quot;)
		this.func := ObjBindMethod(this, &quot;method&quot;)  
	} 
	__Delete()
	{
		MsgBox % A_ThisFunc 
	}
	method()
	{
		MsgBox % A_ThisFunc 
	}  
}

method()
{
	MsgBox % A_ThisFunc 
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-30T17:39:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139251#p139251</id>
		</entry>
</feed>
