Question Detial
- Traits are a mechanism for code reuse in single inheritance.
- A Trait is similar to a class, but only intended to group functionality in a fine-grained and consistent way.
- It is not possible to instantiate a Trait but addition to traditional inheritance. It is intended to reduce some limitations of single inheritance to reuse sets of methods freely in several independent classes living in different class hierarchies.
- Multiple Traits can be inserted into a class by listing them in the use statement, separated by commas(,).
- If two Traits insert a method with the same name, a fatal error is produced.
Hot Questions
How to Get the Size of all Tables in a database in MySQL?