On Thu, May 28, 2009 at 4:28 PM, Luke <luke@xxxxxxxxxxxxxx> wrote: > Right I've read the manual on this and all that so hopefully you find > people > can help. > I have an abstract class with three children. The abstract is ForumObject > and the three children are Thread, Category and Post and each have their > own > table so I wrote the following: > abstract class ForumObject > { > static private $table; > > static function getObjectIds ($field, $value) > { > $query = "SELECT id FROM {self::$table} WHERE $field = '$value'"; > $object_ids = mysql_fetch_array(); > return $object_ids; > } > } > > class Category extends ForumObject > { > static private $table = "categories"; > } > That's just got the important bits for the sake of your eyes but basically > the problem I'm having is calling > Category::getObjectIds ($whatever, $whatever2); > Seems to think that it's referring to ForumObject::$table rather than > Category::$table? > I looked into it and there seems to be something you can do with > get_called_class() but unfortunately I'm stuck with 5.2.9 at the moment and > that is new to 5.3. > Any ideas? Perhaps there is a different way I could implement the classes - > I would rather not have getObjectIds repeated three times! > Thanks in advance, this is a limitation in pre-5.3 php wherein there is no support for static inheritance. another way to do it in 5.3, inside of the ForumObject::getObjectId() method is to use static::$table which will correctly resolve the lookup to the class youd expect. -nathan