Home Cannot create class in AHK after destruction
Reply: 0

Cannot create class in AHK after destruction

user1016 Published in August 15, 2018, 8:44 pm

I'm trying to wrap my head around classes in AHK. I'm C++ dev, so would like to make use of RAII (__New, __Delete), but it looks like I miss some concepts since things look very contra-intuitive for me.

After some tries I came up with this simple example:

class Scenario
    MsgBox, NEW

    MsgBox, DELETE

scenario := new Scenario
scenario := new Scenario
scenario := 1
scenario := {}
scenario := new Scenario

As a result I get the following messages:

  1. NEW
  2. NEW


  1. Why doesn't the object get destroyed during the second assignment? I'd assume the number of refs going to 0, no?
  2. How come I get 2 destructions in a row? Where was that object stored meanwhile? How could scenario variable hold both references?
  3. Why was not the third construction called?
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301025 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO