TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Question (http://www.talkphp.com/advanced-php-programming/2176-question.html)

owenj2o 02-02-2008 10:50 PM

Question
 
Right I have a question.

PHP Code:

class frame {

    private static 
$instance;
    
    public function 
frame() {
        
self::instance &= $this;
    }
    
    static function 
getInstance() {
        return 
self::instance;
    }
}

function 
getInstance() {
    
$intstance frame::getInstance;
    return 
$instance;
}

class 
B expands frame {
    
    public function 
Foo() {
        echo(
'Foo');
    }
    
// Other Functions


If getInstance was ran would I ba able to access class B;
PHP Code:

$blah &= getInstance();
$blah->foo

Many Thanks,
Owen =)

owenj2o 02-03-2008 07:21 PM

-- Nevermind :)

xenon 02-03-2008 09:43 PM

woot?

this one's good:
PHP Code:

class B expands frame 

but this is even better:
PHP Code:

class B stretches frame 

8-):-P

Village Idiot 02-03-2008 09:52 PM

Just a tip for next time, explain what you need help with in the title. You wont get many people with "question" because no one knows if it will be worth their time.

owenj2o 02-03-2008 10:25 PM

What is class stretching and What advantages do I have with stretching a class instead of expanding it.

xenon 02-03-2008 10:34 PM

lol. there's no such keyword as stretching, and there is no expanding, either. A class can be extended, and that's about it. The code above is invalid. This one is valid, though:

PHP Code:

class extends frame {...} 



All times are GMT. The time now is 10:29 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0