public class Initial { public static void main(String[] args) { // TODO Auto-generated method stub Telephone tel1 = new CellPhone(); Telephone tel2 = new SmartPhone(); tel1.call(); tel1.message(); tel2.call(); tel2.message(); } }
结果:
矩形的周长公式为:2(长+宽)
矩形的面积公式为:长*宽
圆形的周长公式为:2πr
圆形的面积公式为:πr2
是这样吗