首页 > 其他 > 详细

实验六 类的封装

时间:2019-04-15 23:02:31      阅读:120      评论:0      收藏:0      [点我收藏+]
class Manager{
    Manager(){ System.out.println("Manager"); }
}
public class ATM{    
    static Manager m;
    ATM(){ 
        m = new Manager();
        System.out.println("ATM");
    }
    public static void main (String[] args) {
        //Customer cus = new Customer();
        new ATM();  new ATM();    new ATM();        
    }
}
package bank;
public class Customer{
    String account;
    private double balance = 0;
    Customer(){}
}
 
package bank.sys;
import bank.Customer;//导入
public class ATM{
    public static void main (String[] args) {
        Customer cus = new Customer();
    }
}
package bank;
class Customer{
    String account;                       
    protected String cname;         
    private double balance;            
    public void quKuan(){}            
    public void cunKuan(){}
}

实验六 类的封装

原文:https://www.cnblogs.com/pblqjyg/p/10713468.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!