"Hey! White?" Lesson plans

customize:override!

Said so many times rewriting,This time we have to rewrite treat seriously what method。

contract

We say,Inheritance is the equivalent of signing a contract,We inherited out of the subclass must comply with this contract,So even if you want to do something where no contract,Must comply with contract specifications,so,You override methods,It must also comply with the type of process。

We talked about the type of approach,It ()->() Such[……]

Click link to continue reading...

Polypeptide? Polymorphic!

We finished the last lesson inheritance,That this lesson we will continue in-depth,What to look at inheritance tree is big move。

You and I could talk about this polymorphic pronunciation,Your first thought should be a high school biology talked of "polypeptide";Ok,The only possibility is to pronounce the same between the two。

Inherited significance

We say that to achieve the extraordinary significance of inherited,It greatly reduces the number of redundant lines in our code,Reducing the difficulty of maintaining the code ......[……]

Click link to continue reading...

In the end how to do:"A" and "a"

Last time we specifically about the inheritance mechanism,And also designed an inheritance tree,So the question is:I'm not going to ask Excavator strong Which? I want to ask how to determine whether a class is a subclass of another class do? How do we design a class instead of a class of attributes?

"A" and "a"

Here we will use such a method to examine the relationship between the two of them:

we say,Pistol firearms --O[……]

Click link to continue reading...

Recalling once again:Inheritance

This time we take a look at a few lessons in succession before mentioned,We had初见 OPEN In a development with a mobile phone (system) to describe inherited this thing chestnuts,I believe we have the impression。

Inheritance

So this lesson we will learn to understand the depth of the concept of inheritance。

This is actually not difficult to understand,You see,when[……]

Click link to continue reading...

It's not what you think:A program website

This lesson we try to develop a simple command-line games,To complete the experience a so-called "development process"。

This game is set:

This is a board game,We guess the location of enemy ships,As long as the number of hits you can send them to sink。

We give these ships the label affixed to point it ...... such a variety of sites?so,This has become a site of attack Behind his program ......。

Goal of the game

We want players to[……]

Click link to continue reading...

Computed properties and packaging

Before we in class,Take a look at the previously mentioned "SoC" concept,We say this is called "Separation of Concerns",I translate it as separation of duties - the different sections that focus on their part。Or a target to achieve a goal。

The goal not only to make the code more modular and easier to maintain,Also let the system run more efficiently。So,We want Object[……]

Click link to continue reading...

Stored value and reference

Declare a variable

We use var to declare a variable,Congguizili like a tube placed in the experimental stage;

We give a specified variable type,Just like in the test tube labeled the;

Then put reagents must be marked on the label - otherwise could cause an explosion or poisoning。

Same,If we try to give a reservoir into a wrong data type,Then the compiler[……]

Click link to continue reading...

Guess the number game:An object of the class difference

A lesson on our first taste OOP Style,Ambiguous classes and objects in exactly what is it? This lesson we use a simple little chestnut to introduce to you。

Trying to explain

We say that the relationship between classes and objects and the relationship between the design of products,Take Our house is,Certainly there will be a corresponding building design,But the design will not only correspond to a building,At least one cell must be met with a design is not it? our[……]

Click link to continue reading...

Our test environment and has shown signs of OOP

Some students did not take into account the iPhone,Swift language learning but at least we will have OS X operating system,Our code shows will be completed in OS X,Using the CLI interface。So although it looks old and was,But believe me take the GUI make you worry a lot - because that is another matter。

So now,Let's say hello and OOP

We take a look,With O[……]

Click link to continue reading...