Learn how humans work to create a more effective computer interface 三种reasoning的方式 Deductive Reasoning (演绎推理): Basically drawing a conclusion based on the data. Inductive Reasoning (归纳推理): If something is ture for x, then it's true for x+1; if it's…
MInimize the accessibility of classes and members 这个叫做所谓的 information hiding ,这么做在于让程序耦合度更低,增加程序的健壮性等等,反正就是很有必要和有用. 四个修饰等级 private :只能当前class中调用 package-praivate 声明class,没有修饰的时候是默认 package-praivate,表示在一个 package里面使用 protect subclass里面调用 public 任意地方…
举一个容易犯错的例子 class Date { private: int month; int day; int year; public: Date(int month,int day,int year) { this->month = month; ... } } //wrong example Date date(,,);//should be 3,30 Date date(,,);//should be 3,30 使用类型可避免这个问题 class Month { ... }; clas…
1. 成员函数的接口总是被继承. 如 Item32 所说, public 意味着 is-a, 所以对 base class 为真的任何事情对 derived class 也为真 2. 声明一个 pure virtual 函数的目的是为了让 derived class 只继承其接口 但令人意外的是, 我们竟然可以为 pure virtual 函数提供定义. 这有另一种用处, 即作为 default 实现 3. 声明 impure virtual 函数的目的是为了让 derived class 继承…