final keyword in oop

<?php

/*We will block a class being inherited by other class using final keyword placing it before class keyword of a class

and after using the final keyword if the class is extends by another class an error will show up .. just like the below example shows ..

final keyword also can be use before a method precisely

*/

final class ap
{
public $a;
}
class bp extends ap
{

}

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s