Namespaces Extends?

php.internals

Nathan Rixham

18 years ago
Hate to bring this one up; I'll be brief! for instance smarty get's upgraded and has it's own namespace, I have a class which extends it, soon to be in my applications namespace which implements an interface in my interfaces namespace.. how does one extend a class in another namespace and indeed implement? namespace application::handlers; { class class_name extends ::b::class_in_other_namespace implements ::c::iTemplate{ public func... } } or would we.. namespace application::handlers; { use b::class_in_other_namespace as other_class; use c::interface_in_other_namespace as other_interface; class class_name extends other_class implements other_interface { public func... } } or..? Thanks!

Nathan Rixham

18 years ago
Scratch that, took the time to test myself.. namespace core; { class base { protected function __construct() { } } class core extends core::base{ protected function __construct() { } } } namespace application_test; { class extender extends core::core { } } $test_extender = new application_test::extender; works just fine - apologies for cluttering the board and indeed posting in the wrong one! Nathan Nathan Rixham wrote:

Greg Beaver

18 years ago
Nathan Rixham wrote:
> Hate to bring this one up; I'll be brief! > > for instance smarty get's upgraded and has it's own namespace, I have a > class which extends it, soon to be in my applications namespace which > implements an interface in my interfaces namespace.. how does one extend > a class in another namespace and indeed implement? > > namespace application::handlers; > { > class class_name extends ::b::class_in_other_namespace implements > ::c::iTemplate{ > public func... > } > } > > or would we.. > > namespace application::handlers; > { > use b::class_in_other_namespace as other_class; > use c::interface_in_other_namespace as other_interface; > class class_name extends other_class implements other_interface { > public func... > } > } > > or..?
Either one is fine. Greg