Date: 04/06/01
- Next message: Sascha Schumann: "Re: [PHP-DEV] Request for new feature: $HTTP_SESSION_VARS when register_globals = on"
- Previous message: Cameron: "[PHP-DEV] compile failure"
- In reply to: Steven Roussey: "[PHP-DEV] Object Constructors in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: "Steven Roussey" <sroussey <email protected>>
Sent: Friday, April 06, 2001 2:19 AM
Subject: [PHP-DEV] Object Constructors in PHP
> Don't ask why it is this way, but say we have these files:
<snip code>
Bad bad BAD programmer! Go to your corner. :-)
> It runs fine printing 'hi' (though not with APC, but fine with Zend
Cache).
>
> BUT, What _should_ happen?
You mean from a PHP perspective or from an OOP perspective?
Your example runs as expected. The contructur Outline_ForumStyle() calls the
inherited method ForumStyle(). Nothing wrong with that.
I think what would be more interesting is, what happens if you instantiate
ForumStyle?
$f = new ForumStyle();
>From an OOP POV, there is no contructor, so nothing should happen. PHP OTOH
recognises the inherited method ForumStyle() as having the same name as the
class, thereby making it a contructor.
Not good IMHO, but i think it stems from the fact that PHP does not have a
keyword for explicitly defining contructors, like you find in Java or C++.
One of the areas in PHP that still need some work is IMHO the OOP area. Some
things are a bit too loosly defined - even for a script language.
- Carsten
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Sascha Schumann: "Re: [PHP-DEV] Request for new feature: $HTTP_SESSION_VARS when register_globals = on"
- Previous message: Cameron: "[PHP-DEV] compile failure"
- In reply to: Steven Roussey: "[PHP-DEV] Object Constructors in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

