   [SOLVED]Handles, References, casting and object creation
  Hi everyone!I am currently debugging my script with the help of the script debugging capabilities of AS. They are really great.This said I hav a problem, which I think is caused mainly by a problem of understanding everything right from my side. Let me explain what I want to do.I have a classes, BoolPort, from the application that has a common abstract base class, Port. They are both registered in the scripting as asOBJ_REF. BoolPort with factories for creation(std/copy constructor) and addRef/release behaviour. The Port base class only has dummy addref and release behaviours as this should in principle never be instantiated.Furthermore I have provided casting behaviours for Port --> BoolPort (asBEHAVE_REF_CAST) and BoolPort --> Port (asBEHAVE_IMPLICIT_REF_CAST). Finally I implemented the assignment operator and exposed it.What I am now doing in the script is, instantiating a BoolPort.//Input portsBoolPort @fsm_end = BoolPort("isEnd");What debugging tells me that there is something wrong with creation of the BoolPort object. The members are not properly initialized even when they should be.What I want to have as a result is a handle to the newly created instances of the class. Is this correct this way? And what role plays the assignment operator in this case, meaning which signature should it have? Do I need to provide an assignment operator with signatureBoolPort* operator=(const BoolPort& obj);or isBoolPort& operator=(const BoolPort& obj);sufficient?In the end I am unsing the variable fsm_end to be passed to another script-created object whose class has been registered by the applicationwith the signature.void addInputPort(Port@,string& in);So here I need an implicit cast, which is there through the registered casting behaviours.However I am not sure if the way from BoolPort object instanciation until passing to the addInputPort method with its implicit casting is correct.Any help would be greatly appreciated.Thanks in advance,Thoran[Edited by - Thoran on May 18, 2010 6:24:57 AM]
  For the record, the question is more or less deprecated. I have the script working now. I am not quite sure whether I am doing things right, but it seems to work.I am creating objects (registered as asOBJ_REF) like the following:BoolPort fsm_end("isEnd");All opAssign assignment operators are implemented to return a reference and not an object handle.With this setup the implicit casting to a method call like (AS notation)//Signaturevoid addInputPort(Port@, string&);//Calltrans.addInputPort(fsm_end,"isEnd");succeeds.Cheers,Thoran