Trait (computer programming): Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 116:
=== PHP ===
This example uses a trait to enhance other classes:
<sourcesyntaxhighlight lang="php">
// The template
trait TSingleton
Line 144:
use TSingleton;
}
</syntaxhighlight>
</source>
 
This allows simulating aspects of multiple inheritance:
<sourcesyntaxhighlight lang="php">
trait TBounding
{
Line 178:
}
}
</syntaxhighlight>
</source>
 
=== Rust ===