How to create child classes like mysqli class in php -
i building little website, , have problem dealing classes. want create class named message_manager
has child named send
(like mysqli class has query has child).
i need because want have variables in send
class. can me it.
class message_manager{ var $sender; var $connection; function __construct($connection, $sender){ $this -> sender = sender; $this -> connection = $connection; } } class send extends message_manager{ var $message_id; private function _send($receiver, $message){ //function sends message , generate $id $this -> message_id = $id; } function __construct($receiver, $message){ return $this -> _send($receiver, $message) } }
//sending message
$conn = new mysqli(....); $messenger = new message_manager($conn, $user1); $a = $messenger -> send($user2, $message); $id = $a -> message_id;
i have tried above code not work. or work-around welcome.
Comments
Post a Comment