這段類別定義的成效與範例 4-1 相同,不過$ units 與$ weightPerUnit 卻不再於變數宣告時設定,而是由成員函式 __construct ( )代勞。使用範例 4-3 定義的 UnitCounter ...
確定! 回上一頁