class composition instead of object composition?
- by fayer
I want a class property to be reference to another class, not its object and then use this property to call the class's static methods.
class Database {
private static $log;
public static function addLog($LogClass) {
self::$log = $LogClass;
}
public static function log() {
self::$log::write(); // seems not possible to write it like this
}
}
any suggestions how i can accomplish this?
cause i have no reason making them objects, i want to use the classes for it.