RE: [PHP] More OOP

From: Date: Thu, 16 Jan 2003 21:55:07 +0000
Subject: RE: [PHP] More OOP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131940@lists.php.net to get a copy of this message
personally, I would ditch the Error class and put raise_error in Base. =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -----Original Message----- From: Jordan Elver [mailto:jordan.elver@dsl.pipex.com] Sent: Thursday, January 16, 2003 3:52 PM To: php-general@lists.php.net Subject: [PHP] More OOP Hi guys, After your previous advice. I have been looking at some more OOP for my application. Is this the sort of way a proper OOP application should be constructed? I want to use smarty as my template language as well, how could I integrate that? <?php class Base { function test_base() { echo 'Some other functions in here maybe?'; } } class Error extends Base { function raise_error() { echo 'I am raising an error'; } } class Database extends Error { function connect($details = '') { echo "Connecting to the database<br />"; // get connections details list($host, $username, $password, $type) = $details; // connect to the database if($connection = mysql_connect($host, $username, $password)) { $this->raise_error(); } } } class Login extends Database { function Login() { echo "Hello, I'm the Login class<br />"; // connect to the database $this->connect(); } } $c = new Database; $c->connect(); Any pointers would be great :) Cheers, Jord -- Jordan Elver You don't have to be mad to work here, but you do have to be on time, well presented, a team player, customer service focused and sober!! -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#131940) next »