好几天没来学习了,昨晚把继承的又整理了一下。想把整理后的东西发到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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Course Machine Learning Note

    Machine Learning Note Introduction Introduction What is Machine Learning? Two definitions of Machine ...

  4. shell learning note

      shell learning note MAIN="/usr/local/" # 变量大写 STATUS="$MAIN/status" # 美元符加字符串是 ...

  5. 2014/09/30 Learning Note

    Vbird Linux: Vim Learning: http://linux.vbird.org/linux_basic/0310vi.php Bash Shell: http://linux.vb ...

  6. [Angular2] @Ngrx/store and @Ngrx/effects learning note

    Just sharing the learning experience related to @ngrx/store and @ngrx/effects. In my personal opinio ...

  7. Machine Learning Note Phase 1( Done!)

    Machine Learning 这是第一份机器学习笔记,创建于2019年7月26日,完成于2019年8月2日. 该笔记包括如下部分: 引言(Introduction) 单变量线性回归(Linear ...

  8. Machine Learning Note

    [Andrew Ng NIPS2016演讲]<Nuts and Bolts of Applying Deep Learning (Andrew Ng) 中文详解:https://mp.weixi ...

  9. Java: some learning note for Java calssloader and Servlet

    1. Java Classloader 链接: https://en.wikipedia.org/wiki/Java_Classloader 摘要: The Java Classloader is a ...

随机推荐

  1. Golang解析json的几种方法

    Golang解析json的几种方法 概要 使用Golang调用其它平台API接口时总会被多层的json串给恶心到,我记录一下自己解析json的几种方法. 一.自带的json包 func JsonUnm ...

  2. Python笔记_第三篇_面向对象_7.多态

    1. 多态的概念 多态:一种事物的多种形态.其表现形式就是连续的继承关系. 还以人喂食动物的例子.最终目标是人可以喂食任何一种动物.如果人要喂食100多种动物,难道要写100中方法吗?多态就是把属性和 ...

  3. js实现新闻滚动-单行滚动或者多行滚动

    注明:都是转载. 先说单行滚动: --------直接复制以下代码即可试验 转载http://www.3lian.com/edu/2011/06-30/4986.html----------- < ...

  4. Python 爬虫 爬取图片入门

    爬虫 网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动的抓取万维网信息的程序或者脚本. 用户看到的网页实质是由 HTML 代码构成的,爬 ...

  5. K3CLOUD日志目录

    业务站点安装目录\K3Cloud\WebSite\App_Data\Log下面找

  6. 3)利用Build.php自动创建目录和文件

    (1)首先做法参照: thinkphp5的手册的  命令行--->自动生成目录结构 或者看云的资料:https://www.kancloud.cn/manual/thinkphp5/118021 ...

  7. 0x06 - Nginx 负载均衡会话保持

    Nginx 负载均衡会话保持 背景 负载均衡时,如果APP需要保持特定状态的时候,就要保证同一用户的 session 会被分配到同一台服务器上. 实现方案 使用cookie 将用户的 session ...

  8. django框架进阶-分页-长期维护

    ##################   分页    ####################### 分页, django有自己内置的分页,但是功能不是很强大,所以自己写一个分页, web页面数据非常 ...

  9. Web Service概述 及 应用案例

    Web Service的定义  W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API,它们可以通过网络进行调用 ...

  10. CMOS

    CMOS是Complementary Metal Oxide Semiconductor(互补金属氧化物半导体)的缩写.它是指制造大规模集成电路芯片用的一种技术或用这种技术制造出来的芯片,是电脑主板上 ...