ID:               5142
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: Linux
 PHP Version:      4.0.0 Release
 New Comment:

implemented in ZE2.


Previous Comments:
------------------------------------------------------------------------

[2000-06-20 11:33:17] [EMAIL PROTECTED]


This is just a simple feature request.

I would like to be able to define methods and properties of a class as
either public or private (public could be the default if not specified,
to maintain backwards compatibility with the current syntax).

Being able to declare methods/properties as private to a class makes a
lot of sense if many people are sharing the same codebase and use
classes they have not written themselves. If all properties and/or
methods of a class are public, then people could possibly set a
property or call a method that would cause the class to misbehave. I
know this can be guarded against by programming the class
"defensively", and also that people could just read the class
definition to learn its proper use, but being able to just declare some
parts of the class as private solves the above problems nicely and
easily.

A syntax such as the following would make sense to me:

class myClass
{
        public {
                var $myPublicProperty;

                function myPublicMethod()
                {
                }
        }
        private {
                var $myPrivateProperty;

                function myPrivateMethod()
                {
                }
        }
}


Please consider this :-)

Best regards
Jesper Juhl
[EMAIL PROTECTED]


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=5142&edit=1

Reply via email to