Friday, September 6, 2013

Java: How to pass a variable into function with interface parameter type

Java: How to pass a variable into function with interface parameter type

Assume class A implements interface B, is it possible to pass List<A> into
a function with parameter List<B>:
List<A> var1;
how to call (with some fix): func(var1)
void func(List<B> var){
}
Any suggestion would be appreciated. Thanks!

No comments:

Post a Comment