I have a super class called LClass. Then I create other classes, which extend LClass.
For example this are classes for tables in database. ( user, order, etc…)
In each of these classes I use some static function getRecordById($id), which returns some array. The difference between these functions, they use different table names for executing. I want to put this static function getRecordById($id) in LClass. The problem is, that function is static, and for this I need some static variables to be set before I do something like $someUser = user::getRecordById($id).
Or any other suggestions?
I have a super class called LClass . Then I create other classes, which
Share
Programming exclusively using static methods is not object oriented programming, it’s “class oriented” programming. And it’s essentially the same as procedural code with a sliver of namespacing. Static methods have their use, but it is limited. Static methods should never do the main work of a class.
Read How Not To Kill Your Testability Using Statics.