php - Pass methods to the class from other class -


मान लें कि हमारे पास index.php है

  वर्ग Foo_class FOOBAR का विस्तार करता है {function __construct () {'Some_other_class.php' की आवश्यकता होती है; नया Some_other_class; $ इस- & gt; say_hello (); }}   

और some_other_class.php

  वर्ग some_other_class {function say_hello () {गूंज "वाह, यह काम करता है!"; }}   

मुझे यह चाहिए कि Foo_class वर्ग में some_other_class वर्ग को शामिल करके और कॉल करके, some_other_class वर्ग Foo_class इसके सभी तरीकों को दे देंगे क्या ऐसा करना और विस्तार नहीं करना संभव है? बेशक, मेरा कोड काम नहीं करेगा।

PHP 5.4 की एक अवधारणा के साथ आता है, फिर से पूछ रहा है।

Comments

Popular posts from this blog

php - Creating canonical URLs with custom route-classes -

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

javascript - What is an alternative to using getElementByClass for hiding multiple elements? -