![]() |
[PHP] Klassenvererbung
Folgende situation:
Code:
Wirft mir "Call to undefined function test()".
class A {
function test() { return "test"; } class B extends A{ } class C extends B{ echo test(); } } Was mach ich falsch? MfG - Ghost007 |
Re: [PHP] Klassenvererbung
Code:
oder...
class A {
public function __construct() { } public function test() { return 'A test'; } } class B extends A { public function __construct() { parent::__construct(); } } class C extends B { public function __construct() { parent::__construct(); } public function test() { return parent::test(); } } $o = new C(); echo $o->test();
Code:
class A {
public function __construct() { } public function test() { return 'A test'; } } class B extends A { public function __construct() { parent::__construct(); } } class C extends B { public function __construct() { parent::__construct(); } } $o = new C(); echo $o->test(); |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:21 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz