Not an answer to your question, but you should not use function names beginning with 2 underscores (__arr in your case) unless you want to use special functionality associated with that name (e.g. __construct). This will avoid possible conflicts with future version of php.

Vivian Steller wrote:

Hi,

i've just another problem concerning classes, inheritance and the '::'
Syntax. Take a look at the following example code:

<pre>
<?php
        class MyClass extends MyParent{
                private $__arr = Array();

public function __construct() {
$this->__arr("test");
}
public function __arr($var) {
array_push($this->__arr, $var);
}
} class MyParent {
public function getClassname() {
print("My classname: " . __class__ . "\n");
print("My classname: " . get_class($this) . "\n");
}
}
$obj = new MyClass();
// print_r($obj);
MyClass::getClassname();
?>
</pre>


Corresponding output:


My classname: MyParent
My classname:



The problem is, that i want MyClass::getClassname() to return "MyClass"?!


Can anybody help me?

Thanks a lot.
vivi


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



Reply via email to