Hey all. Was wondering if someone could take a look at my code to tell me what I’m doing wrong. I can’t figure it out and it should work, right?
I have polymorphic constructors for a class “ZoneRequirement”. It would prefer to declare with integer array, but I can use an integer and it should make it an integer array first then run the first constructor. The code is below:
using UnityEngine;
using System.Collections;
public class ZoneRequirement : ICompare {
private _SingleRequirement requirement;
public ZoneRequirement(int[] req){
requirement = new _SingleRequirement (req);
}
public ZoneRequirement(int req){
int[] temp = new int[] {req};
ZoneRequirement (temp);
}
}
I am getting error, which would denote I am not declaring a variable for this line:
ZoneRequirement (temp);
error CS0119: Expression denotes a type', where a
variable’, value' or
method group’ was expected
This should work? I am declaring a variable. It is declared it isn’t a type! Right?? Does anyone see what I am doing incorrectly. An integer array isn’t a type, right?
Thanks.