I've seen people using inheritance in PHP two different ways, thought I imagine there is more.
Like this:
And this:PHP Code:<?php
public class NumberOne {}
public class NumberTwo extends NumberOne {}
// Number two has access to NumberOne's members within scope
?>
[/php]
<?php
public class NumberOne {}
public class NumberTwo {
$this->two = new NumberOne;
$this->two has access to NumberOne's members within scope
}
?>
[/php]
Sorry for any syntax errors, but you get the idea.
I'm coding a new application that is quite complicated, and was wondering how I should code my application?
I've seen both of these in reasonably upscale code, so I presume it's OK with both.
Could you list the pros and cons?
Thanks,
Charlie.





lol.
Reply With Quote







