好几天没来学习了,昨晚把继承的又整理了一下。想把整理后的东西发到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. 1.docker 的 安装

    1.mac 安装docker 1.1 打开 https://docs.docker.com/docker-for-mac/install/ 1.2 下载 dmg 文件 1.3  打开 docker,d ...

  2. selenium自学进度-2014.12.3

    今天把小米系列的视频看到了倒数第二课 他讲得很好,只是我现在是看第一遍,回头还需要照着视频多练练. 成长的道路问题艰辛的,学习的道路问题孤独的,希望自己能够坚持下去. 不要让今天的努力白费,不能让未来 ...

  3. C++ lock_guard 互斥锁

    概述根据对象的析构函数自动调用的原理,c++11推出了std::lock_guard自动释放锁,其原理是:声明一个局部的lock_guard对象,在其构造函数中进行加锁,在其析构函数中进行解锁.最终的 ...

  4. c语言中,为什么以下程序直接按”Enter“也就是回车程序不结束?

    /************************************************************************* > File Name: system.c ...

  5. Android开发学习2--Android Studio目录结构、Module目录介绍、Android创建及运行和HelloWord的扩展----极其简单的游戏界面

    学习笔记: 1.Android Studio项目结构 Android Studio提供了很多项目结构,最常用的是Android 和 project Project列举出了所有文件. 建议使用Andro ...

  6. SpringBoot 1.5.x 集成 Quartz 任务调度框架

    Quartz 有分 内存方式 和 数据库方式 内存方式任务信息保存在内存中, 停机会丢失, 需手动重新执行, 数据库方式: 任务信息保存在数据库中, 重点是支持集群. 内存方式 RAMJobStore ...

  7. Git-GitHub-GitLab三者之间的联系及区别

    在讲区别以及联系之前先简要的介绍一下,这三者都是什么(本篇文章适合刚入门的新手,大佬请出门左转) 1.什么是 Git? Git 是一个版本控制系统. 版本控制是一种用于记录一个或多个文件内容变化,方便 ...

  8. scala编程(八)——函数和闭包

    当程序变得庞大时,你需要一些方法把它们分割成更小的,更易管理的片段.为了分割控制流,Scala 提供了所有有经验的程序员都熟悉的方式:把代码分割成函数.实际上,Scala 提供了许多 Java 中没有 ...

  9. 74cms_3.5.1 宽字节注入

    第一次进行CMS的代码审计,我选择了2014年发布的74CMS 3.5.1,历史比较久远的CMS往往存在更多的问题,虽然技术上难度不大,但是在思路方面给了我很大的启发.下面我根据我的思路给大家分享一下 ...

  10. 实战_2:eclipseRCP项目结构

    RCP项目目录结构如下: src: java源码目录 bin:class文件目录 JRE System Library: 系统类库依赖,主要是JDK,JRE相关的 Plugin-in Dependen ...