Upcasting can restrict method access to those available in the superclass.
When you upcast, you can only call methods available in the superclass reference, even if the subclass has additional methods. This limits access to subclass-specific functionality. For instance, if `Book` has a method `readSample()`, you cannot call `p.readSample()` if `p` is a `Product` reference.
Additional Notes
How can upcasting impact method visibility?
Track: Java
Topic: Core Java
Focus: Upcasting and Dynamic Dispatch
Topics:Core JavaJavaUpcasting and Dynamic Dispatch