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:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:52 PM
To: [EMAIL PROTECTED]
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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to