Skip to content
What is Traits?
- Code is shortened by using Traits.
- One code is used everywhere just by writing the trait function.
Multi traits use example:
Late static Binding:
- Late static binding helps to override name by using static in echo keyword.
- It helps lot for writing minimum coding.
- The message of the base class is printed using the self keyword and the message of the derived class is printed using the static keyword.
Example to printing the message of base class:
Example of printing the message of derived class: