About Scala's trait

Source: Internet
Author: User

I've been learning Scala for the last one months, and I have a little feeling about trait today, so write it down ...

Trait is called a trait in Scala, and in my personal understanding, trait is equivalent to the combination of interface and abstract class in Java, and can be mixed with multiple trait, and can be written in trait to implement the specific method, With this trait, you can use the trait method in the class, and other classes when calling a method, if the class does not have this method, it will go to trait. And atrait is mixed with another btrait, all subclasses mixed with atrait have all non-abstract methods of btrait.

About Scala's trait

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.