Monday, May 2, 2016

Effective Java

item 16: 
wrapper class


item 17:
The best solution to this problem is to prohibit subclassing in  classes that are not designed and documented to be safely subclassed. Two ways to do this:

  1. Declare the class final
  2. Make all the constructors private or package-private and to add public static factories in the place of the constructors.

Monday, July 27, 2015

C++

http://stackoverflow.com/questions/2391679/why-do-we-need-virtual-methods-in-c

override non-virtual跟virtual的区别是:non-virtual属于early binding(compile time),virtual是late binding(run-time)