dseguy, French
@dseguy@phpc.social avatar

Quizz : when is it useful to add the same trait t in a parent AND in a child class ?

Crell,
@Crell@phpc.social avatar

@dseguy When the trait contains private methods.

cabbey,
@cabbey@phpc.social avatar

@Crell @dseguy yeah, this is why I’ve done it. If the trait deals with private things… methods or members.

Deuchnord,
@Deuchnord@mamot.fr avatar

@dseguy when A overwrites some methods defined in the trait, and B needs the original implementation?
(although it would be better that A selects the methods it really needs from T in this case, of course)

dseguy,
@dseguy@phpc.social avatar

@Deuchnord That is definitely one. Class implementation has precedence, so T might be overwritten by A, but still needed by B.

This is good! And I have a another use case.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • DreamBathrooms
  • InstantRegret
  • thenastyranch
  • magazineikmin
  • khanakhh
  • rosin
  • Youngstown
  • slotface
  • mdbf
  • cisconetworking
  • kavyap
  • cubers
  • everett
  • ngwrru68w68
  • JUstTest
  • Durango
  • osvaldo12
  • tacticalgear
  • modclub
  • normalnudes
  • Leos
  • ethstaker
  • GTA5RPClips
  • tester
  • anitta
  • provamag3
  • megavids
  • lostlight
  • All magazines