2015, Зуев Е.А., Канатов А.В., Концепция наследования в современных языках программирования
http://cyberleninka.ru/article/n/kontse … mirovaniya
http://cyberleninka.ru/article/n/kontse … vaniya.pdf
Из этой доки я узнал, что в языке Scala есть понятие trait, но в статье не было написано что это такое.
Моя первая гипотеза была, что это базовый класс без собственных членов-переменных (member variables).
но это неправильная гипотеза
http://stackoverflow.com/questions/8178 … d-in-trait
абстрактный класс с обязательно виртуальным наследованием?
http://stackoverflow.com/questions/1229 … ct-classes
https://www.safaribooksonline.com/blog/ … heritance/
Scala’s solution to the Diamond Problem is actually fairly simple: it considers the order in which traits are inherited. If there are multiple implementors of a given member, the implementation in the supertype that is furthest to the right (in the list of supertypes) “wins.” Of course, the body of the class or trait doing the inheriting is further to the right than the entire list of supertypes, so it “wins” all conflicts, should it provide an overriding implementation for a member.
В общем, пока в непонятках.
Отредактировано Лис (2017-01-05 16:13:14)