I'm trying to find out weather I can do this or not. I have a class called Template. and I want to extend that classes functionality in another file, but I don't want to change the name.
Do I declare it as
class template extends template
{
// code here
function foo()
{
}
}
or do I just declare it like this?
class template
{
// write function
function foo()
{
}
}
Only if the parent class is in another namespace.
use SomeNamespace\Template as BaseTemplate;
class Template extends BaseTemplate
{
//...
}
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