Demonic Posted July 9, 2008 Share Posted July 9, 2008 Alright say you have 2 classes, one is a sql class and another is a authentication class. The db class uses class methods to store data, if I extend the sql class in the authentication class, will I be able to use the parent classes methods? In the sql class there is: public function query($query) { $this->query = mysql_query( $query ) or trigger_error("There was a mysql error:" . mysql_error(), E_USER_ERROR); } query stores the sql resource so when i extend the sql class will the current child class have a newly create query method for use? Want to make sure that's correct or not. Link to comment https://forums.phpfreaks.com/topic/113854-quick-oop-question/ Share on other sites More sharing options...
Demonic Posted July 9, 2008 Author Share Posted July 9, 2008 Wrong forum can someone move this thorpe or someone. (I can't report my own threads ) Link to comment https://forums.phpfreaks.com/topic/113854-quick-oop-question/#findComment-585078 Share on other sites More sharing options...
trq Posted July 9, 2008 Share Posted July 9, 2008 Yes, classes which extend another actually have all the public methods of the parent available to them. This is all covered in the manual. Having said that, why on earth would an authentication class extend a database class? They are in no way related. Link to comment https://forums.phpfreaks.com/topic/113854-quick-oop-question/#findComment-585100 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.