Issue with class constructor.
Hello. I have an issue with compilator. Here is my code. public Heap () brings an error with "Error - invalid token '(' in class struct or interface member"
But I cant find out why? Its a constructor and Its need to bee directly in a class body.
using UnityEngine; using System.Collections; public class Heap {
public Heap <T> (){
}
}
Answer by dkjunior · Oct 14, 2015 at 05:07 PM
Constructor declaration in a generic class shouldn't have generic parameter. Try this:
public class Heap<T>
{
public Heap()
{
}
}
Your answer
Follow this Question
Related Questions
Why is it giving me this error "cannot implicitly convert type 'int' to 'string'" 3 Answers
Cant load variable of other script from constructor 1 Answer
Using GetComponent without knowing the script name? 1 Answer
(Array) Is a 'field' but is used like a 'type' 1 Answer
Passing in objects to class constructor 0 Answers