好几天没来学习了,昨晚把继承的又整理了一下。想把整理后的东西发到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. 如何选字体(font-family)

    一.默认字体情况 1.Window下: 宋体(SimSun):Win下大部分游览器的默认字体,宋体在小字号下(如12px.14px)的显示效果还可以接受,但是字号一大就非常糟糕了,所以使用的时候要注意 ...

  2. jquery.timepicker.js - 最常用的日期JS控件

    客户提了个需求,输入日期,想也不用想,立刻翻查Jquery,发现是有timepicker.js这个控件,马上就用. 1. 导入库 <script src="https://cdnjs. ...

  3. java中 Spring 定时器定时任务Quartz的正确使用方法集配置

    定时任务我想大家都不默认,现在流行的框架spring就带了定时任何 我的个人网站(http://www.yzcopen.com)上用户上传的文件都是用这套定时任务执行定时清除 第一步:在applica ...

  4. HTML学习的一些笔记

    为什么会出现HTML这个标记语言 超文本标记语言 HyperText Markup Language HTML是超文本标记语言,标准通用标记语言的一个应用. "超文本"就是指页面内 ...

  5. nips2014下载

    nips2014下载 wget http://papers.nips.cc/book/advances-in-neural-information-processing-systems-27-2014 ...

  6. IdentityServer4之Token令牌获取流程分析

    1.asp.net core 是基于管道模式IdentityServer会在注册一个管道处理程序 IdentityServerMiddleware 类专门处理登录验证的逻辑,本次主要讲的是access ...

  7. Java中的堆、栈、方法区

    堆区: 1.存储的全部是对象,每个对象都包含一个与之对应的class的信息.(class的目的是得到操作指令) 2.jvm只有一个堆区(heap)被所有线程共享,堆中不存放基本类型和对象引用,只存放对 ...

  8. mybatis 自定义类型转换器 (后台日期类型插入数据库)

    后台日期类型插入数据库 有以下几种发法: 1 调用数据库 日期字符串转日期函数 str_to_date("日期","yyyy-MM-dd HH:mm:ss") ...

  9. linux c 调用 so 库

    /***********编译时要链接 -l dl 库************/ #include<stdlib.h> #include<stdio.h> #include< ...

  10. Convert between Unix and Windows text files - IU Knowledge Base from: https://kb.iu.edu/d/acux

    vi. To input the ^M character, press Ctrl-v , and then press Enter or return . In vim, use :set ff=u ...