The difference between “public” and “public static”?

后端 未结 5 905
小鲜肉
小鲜肉 2021-01-30 06:58

What does static mean?

I know public means that it can be accessed from outside the class, and private only from inside the class…

5条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 07:15

    From http://php.net/manual/en/language.oop5.static.php

    Declaring class properties or methods as static makes them accessible without needing an instantiation of the class. A property declared as static can not be accessed with an instantiated class object (though a static method can).

提交回复
热议问题