For example if I have a class that constructs a Timecode object, I would like to sometimes initialise a instance by just providing a value for a single parameter (frameCount) and other times provide more than one parameter such as frameCount and frameRate.
Here is what I tried:
but the above just throws an error:
I know that V1 is as dead as latin, and V2 classes are much better now but until the library porting for V2 catches up, I will be on V1.
Any help would be greatly appreciated!
Here is what I tried:
CODE:
obj := new timecode(2);Default to using 12 frames per second
print(obj);prints ---> {"frameCount": 24, "framerate": 12}
obj := new timecode(2, 24) ;Use the provided frame rate
print(obj);prints ---> {"frameCount": 48, "framerate": 24}
class timecode
{
__New(frames)
{
this.frameCount := frames * 12
this.framerate := 12
}
__New(frames, framerate)
{
this.frameCount := frames * framerate
this.framerate := framerate
}
}
but the above just throws an error:
CODE:
==> Duplicate declaration.
Specifically: __New
AutoHotkey closed for the following exit code: 2
I know that V1 is as dead as latin, and V2 classes are much better now but until the library porting for V2 catches up, I will be on V1.
Any help would be greatly appreciated!
Statistics: Posted by Ralf_Reddings200244 — Today, 17:31