What are traits?

0

Traits are a mechanism that lets you create reusable code in PHP and similar languages where multiple inheritances are not supported. It’s not possible to instantiate it on its own.

A trait is intended to reduce the limitations of single inheritance by enabling a developer to reuse sets of methods freely in many independent classes living in different hierarchies of class.

Php
asked May 17, 2023 at 17:22
Sign in to add a comment

0 Answers

0
πŸ“ No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.