åãã©ã¡ã¼ã¿ã®å¤ä½ åãã©ã¡ã¼ã¿ã«ã¯ + ã - ã®å¤ä½ã¢ããã¼ã·ã§ã³ãä»ãããã¨ã§å¤ä½æå®ãã§ãããåãã©ã¡ã¼ã¿ã®å¤ä½ã«ã¯ä»¥ä¸ã®3ã¤ãããã ä¸å¤(nonvariant) : [A] å ±å¤(covariant) : [+A] åå¤(contravariant) : [-A] ä¸å¤ ä¸å¤ã¨ããå ´åãfuncã®å¼æ°ã«ã¯åãã©ã¡ã¼ã¿ã§æå®ãããã®ã¨åããã®ããåãä»ããªãã object Sample001 { class Nonvariant[A] def func(arg:Nonvariant[Number]) {println(arg)} def main(args: Array[String]) { func(new Nonvariant[Any]) // ã¨ã©ã¼ func(new Nonvariant[Number]) // OK func(new Nonvariant[Intege
{{#tags}}- {{label}}
{{/tags}}