doujie4344 2015-12-10 12:42
浏览 20
已采纳

PHP - 使用静态属性和方法

If I have a class called Sales, which has only static attributes and methods: - What kind of constructor should I write for this class? - How can I make calls to the methods and attributes of this class inside of its own scope?

  • 写回答

2条回答 默认 最新

  • dqy92287 2015-12-10 12:43
    关注

    You can use self::method(); operator to call it's own methods and attributes..

    Constructor

    private function __construct()
    {
       // Your "heavy" initialization stuff here
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?