Hi,
is it possible to overload the class construct(or) ?
if yes, how ?
thx.
--
Alain
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
2008/10/23 Alain Roger [EMAIL PROTECTED]:
is it possible to overload the class construct(or) ?
if yes, how ?
class A
{
function __construct()
{
echo A;
}
}
class B extends A
{
function __construct()
{
echo B;
thanks a lot, this is exactly what i needed.
if the construct of based class A accept arguments, i guess that construct
of class B must have the sames.
moreover, i guess that something like that must be written:
class A
{
function __construct($nameA)
{
...
}
}
class B extends A
{
Alain Roger wrote:
thanks a lot, this is exactly what i needed.
if the construct of based class A accept arguments, i guess that construct
of class B must have the sames.
moreover, i guess that something like that must be written:
class A
{
function __construct($nameA)
{
...
}
}
class
2008/10/23 Alain Roger [EMAIL PROTECTED]:
thanks a lot, this is exactly what i needed.
if the construct of based class A accept arguments, i guess that construct
of class B must have the sames.
No, you can change the signature of a method when you overload it.
Below, B::__construct() accepts 1
Alain Roger schreef:
thanks a lot, this is exactly what i needed.
if the construct of based class A accept arguments, i guess that construct
of class B must have the sames.
moreover, i guess that something like that must be written:
I guess you find guessing preferable to RTFM and/or trying
is it possible to overload the class construct(or) ?
if yes, how ?
No, it's not.
class A
{
function __construct()
{
echo A;
}
}
class B extends A
{
function __construct()
{
echo B;
On 31 Jan 2006, at 13:52, David Grant wrote:
Drop __construct, PHP5 will call Test() anyway.
From http://uk.php.net/manual/en/language.oop5.decon.php:
For backwards compatibility, if PHP 5 cannot find a __construct()
function for a given class, it will search for the old-style
constructor
Hi,
I'm writing a simple class. In order to be compatible with php4 and php5 I've
done this :
class test{
function Test(){
//This will be called in PHP4
}
function __construct(){
//This will be called in PHP5
$this-Test();
You could try with phpversion().
Georgi Ivanov wrote:
Hi,
I'm writing a simple class. In order to be compatible with php4 and php5 I've
done this :
class test{
function Test(){
//This will be called in PHP4
}
function __construct(){
Georgi,
Drop __construct, PHP5 will call Test() anyway.
From http://uk.php.net/manual/en/language.oop5.decon.php:
For backwards compatibility, if PHP 5 cannot find a __construct()
function for a given class, it will search for the old-style constructor
function, by the name of the class.
David
Yes, I noticed that PHP5 call the old way constructor, but what if in future
version they drop this feature ?
I think this is workaround for the problem . Or not ?
On Tuesday January 31 2006 15:52, David Grant wrote:
Georgi,
Drop __construct, PHP5 will call Test() anyway.
From
On Tue, January 31, 2006 7:46 am, Georgi Ivanov wrote:
I'm writing a simple class. In order to be compatible with php4 and
php5 I've
done this :
class test{
function Test(){
//This will be called in PHP4
}
function __construct(){
//This will
Hi to all,
I'm a C++ programmer and I've to convert some simple classes
from C++ to PHP. My toolbar_button class must have two or more
constructors so I ask you if this is possible with PHP:
class toolbar_button
{
CString m_name, m_tooltip, m_image, m_action;
bool m_state,
[EMAIL PROTECTED] wrote:
Hi to all,
I'm a C++ programmer and I've to convert some simple classes
from C++ to PHP. My toolbar_button class must have two or more
constructors so I ask you if this is possible with PHP:
You can't overload a constructor, I mean a function in PHP. Maybe
extending two
15 matches
Mail list logo