摘要: 1 package cn.temptation; 2 3 public class Sample01 { 4 public static void main(String[] args) { 5 // 仔细想一想,Animal应该是一个抽象的概念,相对于Animal来说,狗才是具体的概念 6 // Animal的行为也应该算是一个抽象的行为 ... 阅读全文
posted @ 2017-03-12 21:47 {name:"代码屠夫"} 阅读(589) 评论(0) 推荐(0) 编辑
摘要: 1 package cn.temptation; 2 3 public class Sample01 { 4 public static void main(String[] args) { 5 // 继承关系的子类可以重写父类给它的成员方法 6 // 有时,父类不希望它的成员方法被子类重写(覆盖),对于这种要求,如何处理? 7 ... 阅读全文
posted @ 2017-03-12 21:22 {name:"代码屠夫"} 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 1 package cn.temptation; 2 3 public class Sample01 { 4 public static void main(String[] args) { 5 // 继承关系中的private访问权限:子类只能访问父类中的非私有的成员 6 } 7 } 8 9 //// 父类 10 //class Fathe... 阅读全文
posted @ 2017-03-12 12:03 {name:"代码屠夫"} 阅读(490) 评论(0) 推荐(0) 编辑