oops things to remember about class methods and everything

Hi all , this post is just to highlight some important facts of oops n php. I am trying to categories them like class / interface / basic etc. Please put your comments if you want to suggest any category. Lets start..

Class
1. When a class defined as final it can no longer extended by other classes and function defined as final then it cant be overridden in child classes.

2. A abstract class cannot be instantiated and it can only be extended.

3. Class constants are public, and accessible from all scopes.

4. class can only extend one parent class, but it can implement multiple
interfaces
.

5. In php5 class objects are always passed as reference rather than a value.

6. destructors are introduced in php5 but we cant determine the order of destroying of two different objects in our script.

7. 4 access specifiers are introduced public,private,protected,final.

8. the final specifier can be used for only classes and functions. If class is defined as final then it cant be extended.

9. Member variable can be initialized at the time of declaration.

10. Access to static property of class through the object will produce an notice. where as in php4 it was completely acceptable. Check sample code

11. Class constants are public, and accessible from all scopes.

12. We can implement more than one interfaces in one class.

13. Exceptions are the objects created whenever there is any error in script.
__________________________________________________________________________
Methods

__________________________________________________________________________
Interface

__________________________________________________________________________
access specifiers

__________________________________________________________________________
exception handling

__________________________________________________________________________
keywords

__________________________________________________________________________

1 comments:

Jules said...

Thank you, that was a short and sweet listing of php5 reminders! =)

Post a Comment

Post your helpful suggestions on this...

 
 
 

typo3 cms templates tutorial

PHP news

php freelancer mumbai India