Traits in PHP

What are the Traits in Laravel?

  • Traits are a simple group of methods that you want to include in another class.

Why we use Traits?

  • A Trait, like an abstract class, cannot be instantiated by itself. The trait is created to reduce the limitations of single inheritance in PHP by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies.

Comments

Popular posts from this blog

Basic Terminology

What is normalization in DBMS?

Object oriented programming concepts in PHP