Как получить ссылку на дочерний универсальный тип из родительского универсального типа? ⇐ JAVA
-
Anonymous
Как получить ссылку на дочерний универсальный тип из родительского универсального типа?
here is the scenario
class MyClass1{ } class MyClass2 extends MyClass1{ } class Parent{ List list; } class Child extends Parent{ } this doesn't compile
Parent p = new Child(); this does
Parent p = new Child(); why?
is there a way to refer via parent type?
Источник: https://stackoverflow.com/questions/288 ... neric-type
here is the scenario
class MyClass1{ } class MyClass2 extends MyClass1{ } class Parent{ List list; } class Child extends Parent{ } this doesn't compile
Parent p = new Child(); this does
Parent p = new Child(); why?
is there a way to refer via parent type?
Источник: https://stackoverflow.com/questions/288 ... neric-type