public class B extends C {
}
What does this mean? That C needs to extend A? What extra restriction am I putting instead of just saying B ext
Class B
is a C
.
C
and B
are parameterized with an A
. (Which means they can have methods and such that use A
methods, or the methods of classes that descend from A.)
A classic use case for this would be that you have a DAO (Data Access Object). You make a generic DAO with some basic methods, like GenericDAO
with a generic save
method. To make it so other DAOs can extend GenericDAO
, you parameterize that class with Entity
, and you make sure all your Entity
s are saveable.
Then you have GenericDAO
UserDAO extends GenericDAO
where User is an entity.