What is access modifier?
Posted by Raj
Access modifier:
OOP provides data-hiding capabilities with public, protected, and private data attributes and methods:
Public : A public variable or method can be accessed directly by any user of the class.
Protected : A protected variable or method cannot be accessed by users of the class but can be accessed inside a subclass that inherits from the class.
Private:A private variable or method can only be accessed internally from the class in which it is defined.
OOP provides data-hiding capabilities with public, protected, and private data attributes and methods:
Public : A public variable or method can be accessed directly by any user of the class.
Protected : A protected variable or method cannot be accessed by users of the class but can be accessed inside a subclass that inherits from the class.
Private:A private variable or method can only be accessed internally from the class in which it is defined.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
access modifier,
OOP interview questions and answers,
PHP,
PHP interview questions and answers
.You can leave a response, or trackback from your own site.