📜  java代码示例中的向上转换

📅  最后修改于: 2022-03-11 14:52:41.546000             🧑  作者: Mango

代码示例2
Upcasting is a type of object typecasting in which a child object is typecasted to a parent class object. By using the Upcasting, we can easily access the variables and methods of the parent class to the child class. Here, we don't access all the variables and the method. We access only some specified variables and methods of the child class. Upcasting is also known as Generalization and Widening.