
| The busy Java developer's guide to Scala: Implementation inheritance | |||
| 摘自: IBM developerWorks Worldwide 被阅读次数: 138 | |||
由 yangyi 于 2008-09-13 23:47:46 提供 | |||
Level: Intermediate Ted Neward (ted@tedneward.com), Principal, Neward & Associates 28 May 2008 Scala gives you just as much support for implementation inheritance as the Java™ language does — but Scala's inheritance yields a few surprises. This month, Ted Neward introduces you to polymorphism done the Scala way, blending functional and object-oriented language styles while still mapping perfectly to the Java platform's inheritance model. For the better part of 20 years, a staple of object-oriented language design has been the notion of inheritance. Languages that do not support inheritance, such as Visual Basic, are derided for being "toy languages," unsuited to real work. Meanwhile, languages that do support inheritance do so differently, leading to many hours of debate. Is multiple inheritance really necessary (as the maker of C++ decided), or is it gratuitous and ugly (as determined by the makers of C# and the Java language)? Ruby and Scala are two newer languages that have taken the middle course on multiple inheritance — as I discussed last month when introducing Scala's traits (see Resources).
|