I am having trouble finding out how to create a function that creates and instance of an object where the name of the variable that holds the function is specified in the parameter of the function. I am writing an assignment where I do not know how many instances of the object that is to be created. I know how to call the constructor in a function, but I do not know how to give each instance a unique name?
let test() = class
let variable = 1
end
let createInstance (name : string) =
let name = new Test()
This is just a test example. This is what I have tried, but the function does not parse the string "name" to be the name of the object instance variable.
Thanks!