I would like to know if when I make a list treemap
of objects Producto
which has byproducts in inheritance type:
ProductoA
ProductoB
Could you just show the ProductoA
?
This is how I believe it:
public Cataleg(){
super();
this.map_catalogo= new TreeMap<String,Producto>();
}
After doing a method where I add the products either A
or B
, I can show them all like this:
public void mostrarProductos(){
System.out.println("Productos disponibles en almacen: ");
for(Producto p : map_catalogo.values()) {
System.out.println(p);
}
}
I would like to know how you can only show me the ProductosA
(which is a subclass of Producto
).