Public, Private, Protected, Static Function

Public - Available to everyone who can access the class. If a function without declared as private or protected, it is public. In PHP, when variable is declared with keyword 'var', it is declared as public.

Private - Available only within the class where the function/variable is declared.

Protected - Available only within the class, or any class that is derived from the class, or called inherited.

Dynamic - Can only be called after create an object (instantiation) from the class. If a function without declared as static, it is dynamic.

Static - Can be called without creating an object (instantiation) from the class.


http://www.daniweb.com/forums/thread285410.html
http://www.killerphp.com/tutorials/object-oriented-php/php-objects-page-3.php

No comments:

Post a Comment

Labels