コード例 #1
0
ファイル: trait.php プロジェクト: sajjad4930/php-practice
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
trait MySecurity
{
    public $int = 10;
    public function showMysecurity()
    {
        echo "I am trait \n";
    }
}
trait Myfiles
{
    public function showmyname()
    {
        echo "I am from file.";
    }
}
class Accounting
{
    use MySecurity, Myfiles;
}
$a = new Accounting();
echo $a->int;
$a->showMysecurity();