Generic constraints on classes

About Monkey 2 Forums Monkey 2 Development Generic constraints on classes

This topic contains 0 replies, has 1 voice, and was last updated by  Arjailer 2 years, 10 months ago.

Viewing 1 post (of 1 total)
  • Author
  • #2896


    I really like the generic constraints, e.g:

    Can these be added to classes and interfaces, or are they just for methods?

    Would like to be able to do:


    Edit: Hmmm … wonder if just putting it on one method would achieve the same thing …

    Edit: Looks like just having some maths in the code enforces a numeric type anyway. Will try without the maths code.

    Edit: Nope – putting constraints on the methods doesn’t enforce them for the class.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.