oop - Do not want to instantiate objects in php classes -
can have static classes in php ? dont want instantiate class, there possible way of doing have in java , c# ?
no, cannot declare class static in php, @ least not aware of that. but, can declare functions in class static.
you can declare constructor private prevent class getting instantiated, , prevent class being inherited declare class final.
final class myclass private function __construct() { // cannot instantiate class } public static function mystaticfunction() { // static function } }
Comments
Post a Comment