Java Programming : Polymorphic Arguments

来源:互联网 发布:淘宝旗舰店怎么搜 编辑:程序博客网 时间:2024/06/03 19:04

public class fatty {

public void digist(food x){x.eat();}}

import javax.swing.JFrame;public class Main {public static void main(String[] args){fatty bucky = new fatty();food fo = new food();food po = new potpie();bucky.digist(fo);bucky.digist(po);}}





接在上一个话题

the result is : 

this food is great
this potpie is great


原创粉丝点击