package com.question.question;
/**
* @author kankan
* @creater 2019-05-27 19:30
*/
public class Base {
public void method(){
System.out.println("Base");
}
}
多態問題,無論向上向下轉型,都記住一句話:
編譯看左邊,運行看右邊
意思:編譯時候,看左邊的對象有沒有該方法,運行時候結果看new的對象時誰,就調用誰的方法