Can a class Extend or Override himself?

Posted by EBAGHAKI on Stack Overflow See other posts from Stack Overflow or by EBAGHAKI
Published on 2010-04-10T11:52:59Z Indexed on 2010/04/10 12:03 UTC
Read the original article Hit count: 230

Filed under:

Suppose we have a class. We create an object from the class and when we do the class Extends himself base on the object initialization value..

For example:

$objectType1 = new Types(1);
$objectType1->Activate(); // It calls an activation function for type 1

$objectType2 = new Types(2);
$objectType2->Activate(); // It calls an activation function for type 2

I don't want to use the standard procedure of class extending:

class type1 extends types{}

© Stack Overflow or respective owner

Related posts about php