awkwardness in creating object
问题 Temp1 t1=new Temp2(); Here Temp1 is superclass of Temp2. The code works perfectly fine and t1 do acts as a reference variable for Temp1 but how can Temp2() works as constructor for Temp1? 回答1: This is the basis for polymorphism: Imagine you have several child classes that inherit from you parent class. You want to use all these child classes through the interface / methods defined on your parent class, without worrying about the implementation details in each child class (each might do