Type Constraints
The generic parameter T can represent any type, but this creates a problem: inside the function body, the compiler doesn't know the concrete type of T, so it cannot call any of its member functions or access properties. For example, you cannot perform + 1 on a value of type T or print it.
The where clause can constrain generic parameters, specifying interfaces they must implement or parent classes they must inherit from. For instance, where T <: ToString means T must implement the ToString interface, allowing you to safely call the toString() method inside the function body.
The code on the right defines a Printable interface, then uses where T <: Printable to constrain the generic functions printItem and printAll. Inside these functions, you can call the display() method because the compiler knows that all passed types implement this interface.