Class question - multiple objects
Posted: Fri Jun 27, 2003 12:28 pm
I'm teaching myself more about classes and objects and interacting with multiple objects so here's my question...
I have a user class the user class does things like register user, verify password, etc...
I also have an error class, this class has methods such as is_string, is_numeric, etc... testing input basically.
I would like to keep the user class and the error class seperate but allow them to interact. What is the best way to do this?
For instance lets say I have a page called account.php and on this page I need to register a user so do I include both the error and user class or do I just include the user class and then let the user class include the error class?
What is the best way to interact with objects?
do I create the error object inside the user class? hope this isn't too much ranting. thanks!
I have a user class the user class does things like register user, verify password, etc...
I also have an error class, this class has methods such as is_string, is_numeric, etc... testing input basically.
I would like to keep the user class and the error class seperate but allow them to interact. What is the best way to do this?
For instance lets say I have a page called account.php and on this page I need to register a user so do I include both the error and user class or do I just include the user class and then let the user class include the error class?
What is the best way to interact with objects?
Code: Select all
<?php
class user{
function register()
{
$error = new error_class();
$error->is_numeric($string);
}
} // end class
?>