when we make an interface with a type T the T as I understand it can swapped out for any type like a sprite? But what does: where T : class mean?
public interface IDragDestination< T > where T : class
when we make an interface with a type T the T as I understand it can swapped out for any type like a sprite? But what does: where T : class mean?
public interface IDragDestination< T > where T : class
where T : class is a constraint. In this case it means T must be a class. If you try, you will find that you cannot put Vector3 in there because Vector3 is not a class, but a struct. We could have where T : MonoBehaviour, for example, which would then constrain T to be a MonoBehaviour.
thnx!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.