I have a class:
class test {
function __construct() {
print 'hello';
}
function func_one() {
print 'world';
}
}
what I would like to do is a have a class that sort of extends the test class. I say 'sort of', because the class needs to be able to run whatever function the test class is able to run, but NOT run the construct unless I ask it to. I do not want to override the construct. Anyone has any idea how to achieve this?
class test {
function __construct() {
print 'hello';
}
function func_one() {
print 'world';
}
}
class test_2 extends test {
function __construct() {
if (i want to) {
parent::__construct();
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With