传送门:http://poj.org/problem?id1651 Multiplication PuzzleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13109 Accepted: 8034Description The multiplication puzzle is played with a row of cards, each containing a single positive integ…
为什么使用上转型?因为当一个父类有很多子类,子类都重写了父类的方法并加以使用。这时候,如果要在之前代码让你用其他子类来实现,就变得很简单,只需要把A a new B();换成A a new C();(假设B和C都继承了A&…