0

I want to replace a class which is loaded in main project by $addon= new Add_On; the Add_On class has the structure I like but I want to replace all its details. I can comment out the $addon = new Add_on in main project and load my own , but I don't want to modify the main project's code directly. How can I replace this class?

3 Answers 3

2

First, rename the Add_On class to something else, like Base_Add_On, then append this to the file where it is defined:

class Add_On extends Base_Add_On
{
    // your custom replacements here
}
0
0

if you can make change to auto_load or spl_auto_load function in your project ,you will replace these classes with your own.

-1

Create a new class extending Add_On class:

Class Replace_Add_On extends Add_On {
    // Override any functions or add new ones
}
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.