[HELP] Single questions & Help Thread [n00b] (66)

26 Name: PHP QUESTION : 2008-06-09 03:06 ID:V7mp15x0

I assumed that the keyword private, and similarly protected, were
meant to do more than just prevent a class member from being modified
from outside of the class (by foreign functions).
The inability to print or copy a private property's value implies that
the value is hidden, and therefore not expected to be visible from
outside of the class.
Yet, any value of an object, whether private or protected, can be
easily be seen by converting the object to an array. The array not
only holds the values, but also the names of each member.
Does every OOP language allow such easy access to private properties?

function get_object_values( $any_object ) {
$values = (array)$any_object;
return (array_values( $values ));
}
This thread has been closed. You cannot post in this thread any longer.