Just double checking with the php crowd.
Code example:
-------------
<?php

$bar = new second_class;
echo $bar->foo() . '<br />';
var_dump(get_class_methods('second_class'));

class first_class
{
   function foo()
   {
       echo 'foo from class first_class';
   }
}

class second_class extends first_class
{
   function foo()
   {
       echo 'foo from class second_class';
   }
}

?>
-----------
My goal (if feasable). To be able to house multiple classes under one class, and to not have copied references of one class in
another.
For example, housing ADODB, Smarty, and other misc classes under one class/object,
and not having a copied reference to ADODB in other "child" classes that need access to a database.
Now to my code snippet above.
What Im testing is to see if class methods behave like regular functions, where
it cannot be defined more than once.
Trying to define a function more than once produces an error, but it seems that redefining a class method overwrites the previous class method of the same name.
So if I were to work towards my goal, there is a possiblity that class methods can overwrite themselves.
So (theoritically) if Smarty and ADODB have the same class method names, problems would arise.


So Im looking to see if this is "normal" class behaviour.
If so, then I shouldn't even try to work towards my goal, as its not prudent.


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



Reply via email to