Inheritance Learning Note

好几天没来学习了,昨晚把继承的又整理了一下。想把整理后的东西发到hexo博客上来,却发现命令行又失效了。前几天明明是好的,这几天又没有进行任何操作,网上搜了一下也没有招到合适的解决办法,无奈只能重装了。小白就是要折腾,下面贴上继承的第一个学习笔记
How to design the inheritance tree
1.Look for objects that have common attributions and behaviors.
2.Design a class that represents the common state and behavior.
3.Decide if a subclass needs behaviors(method implementations) that are specific to that particular subclass type.
4.Look for more opportunities to use abstraction, by finding two or more subclass that might need common behavior.
4 designing principles
1.DO use inheritance when one class is 大专栏 Inheritance Learning Notea more specific type of a superclass .
2.DO consider inheritance when you have behavior(implemented code) that should be shared among multiple classes of the same general type.
3.DO NOT use inheritance just so that you can reuse code from another class, if the relationship between the superclass and subclass violate either of the above two rules.
4.DO NOT use inheritance if the subclass and superclass do not pass the IS-A test.
Rules for overriding
The method are the contract
1.Arguments must be the same, and return types must be compatible.
2.The method can’t be less accessible.
Rules for overloading
1.The return types can be different.
2.you can’t change ONLY the return type.
3.You can vary the access levels in any direction.
坚持
Runbo
Inheritance Learning Note的更多相关文章
- Learning note for Binding and validation
Summary of my learning note for WPF Binding Binding to DataSet. when we want to add new record, we s ...
- Learning Note: SQL Server VS Oracle–Database architecture
http://www.sqlpanda.com/2013/07/learning-note-sql-server-vs.html This is my learning note base on t ...
- Course Machine Learning Note
Machine Learning Note Introduction Introduction What is Machine Learning? Two definitions of Machine ...
- shell learning note
shell learning note MAIN="/usr/local/" # 变量大写 STATUS="$MAIN/status" # 美元符加字符串是 ...
- 2014/09/30 Learning Note
Vbird Linux: Vim Learning: http://linux.vbird.org/linux_basic/0310vi.php Bash Shell: http://linux.vb ...
- [Angular2] @Ngrx/store and @Ngrx/effects learning note
Just sharing the learning experience related to @ngrx/store and @ngrx/effects. In my personal opinio ...
- Machine Learning Note Phase 1( Done!)
Machine Learning 这是第一份机器学习笔记,创建于2019年7月26日,完成于2019年8月2日. 该笔记包括如下部分: 引言(Introduction) 单变量线性回归(Linear ...
- Machine Learning Note
[Andrew Ng NIPS2016演讲]<Nuts and Bolts of Applying Deep Learning (Andrew Ng) 中文详解:https://mp.weixi ...
- Java: some learning note for Java calssloader and Servlet
1. Java Classloader 链接: https://en.wikipedia.org/wiki/Java_Classloader 摘要: The Java Classloader is a ...
随机推荐
- C/S 和 B/S架构
C/S 和 B/S架构 一.单机架构 应用领域: 植物大战僵尸 office 二.C/S架构 [ 应用领域: QQ 大型网络游戏 计算机发展初期用户去取数据,直接就去主机拿,从这里开始就分出了客户端和 ...
- redis备忘录
Redis 是一个基于内存的高性能key-value数据库.Redis本质上是一个Key-Value类型的内存数据库,很像memcached,整个数据库统统加载在内存当中进行操作,定期通过异步操作把数 ...
- 【shell】概述
功能简介 批量自动初始化系统(update,软件安装,时区设置,安全策略...) 批量自动部署软件(LAMP,LNMP,Nginx,LVS,Tomcat) 管理应用程序(KVM,集群管理扩容,MySQ ...
- 三十五、lamp经典组合搭建
一.安装mysql数据库 1.1 创建组和用户: 1)groupadd mysql 2)useradd mysql -g mysql -M -s /sbin/nologin 3)config ...
- python类的书写、调用
注意:stu1=Luffy('xing',19) 和 Luffy.__init__(stu1,'xing',19) 是等价的. 查看类的使用方法 粘贴一个网上python学习资料
- dedecms_5.7 download.php SQL注入
最近在看Web渗透与漏洞挖掘,这本书的编写目的感觉非常的不错,把渗透和代码审计结合在一起,但是代码审计部分感觉思路个人认为并不是很清晰,在学习dedecms v5.7 SQL注入的时候就只看懂了漏洞, ...
- java中==和equals
/** * @author zhaojiatao * @date 2018/7/19 */ public class equalsLearn { public static void main(Str ...
- 分类算法之KNN分类
1.介绍 KNN是k nearest neighbor 的简称,即k最邻近,就是找k个最近的实例投票决定新实例的类标.KNN是一种基于实例的学习算法,它不同于贝叶斯.决策树等算法,KNN不需要训练,当 ...
- WebService客户端生成方法
1.使用JDK的wsimport.exe产生客户端代码 打开cmd命令框,输入如下格式命令: 格式:wsimport -s "src目录" -p "生成类所在包名&quo ...
- 之前工作过程中自定义的代码生成器模版,codesimit
动软代码生成器 和codesmith 5年前的东西,或许有些过时 动软的功能有限,改的也比较简单,已弃. codesmith可定制性强,当时自已改的,提高了团队的整体工作效率. codesmith代码 ...