Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- abstract class Database{
- static public $connection;
- static public function getConnectionCount(){
- echo "<br>Current connection : ". self::$connection ;
- }
- static public function increaseCount(){
- self::$connection++ ;
- }
- abstract public function connect();
- }
- class MySQL extends Database{
- public function connect(){ //implement connect
- Database::increaseCount(); //access static method
- echo "<br>Connect to MySQL";
- }
- public function save(){
- echo "<br>Save to Database";
- }
- }
- $mysql = new MySQL();
- $mysql->connect();
- $mysql->save();
- Database::getConnectionCount(); //access static method
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement